FIT2095 Lecture Notes - Lecture 4: Dynamic Html, Express.Js, Hypertext Transfer Protocol

125 views2 pages

Document Summary

Need to use app. set to de ne a value. Use app. get to retrieve the value based on the key/name of the setting. Set the port number: app. set( (cid:518)port(cid:519), 8080) ; Use app. set() to show variable to templates application-wide. App. set ( (cid:518) appname(cid:519) , (cid:518)fit2095 app(cid:519) ); These functions can be used to add functionality to express app. A function that has access to request and response objects. Gets invoked by express to do some tasks body-parser. Parse incoming request bodies in a middleware before your handlers, available under the req. body property. Get request used to get data from the server. Post request used to get from client to the server such as username and password elds. Generates logs automatically to any request being made. Rendering engine allows you to use static les in applications. Engine replaces variables in a template le with actual values. This makes it easier to design dynamic html pages. Lets you generate html markup with javascript.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers