Please enable JavaScript.
Coggle requires JavaScript to display documents.
Express Js (Folder Structure (bin: Location where the startup scripts of…
Express Js
Helps Node Js in...
Adding handler specific for different HTTP verbs like POST,GET
-
Serving static files like HTML, CSS
Dynamically create the response using templates, etc.
-
Features
-
Lightweight: Robust enough to support simple applications, together with complex or hybrid applications that require a lot of focus.
Flexible: Based on middleware technology, which are pluggable javascript components for implementing different functionalities.
-
Functionalities
-
-
Add cross-cutting concerns like logging, authentication, etc. easily using the middleware concept in Express.
Organize the web application configurations such as the port to be used for connecting to server, etc. easily using Express.
Folder Structure
-
-
-
-
views: The directory which contains the templates, to create the HTML for any pages generated by the express application.
app.js: The the starting point of the application which contains the application level configurations.
package.json: The file which defines the application dependencies and other information. It also defines a startup script that will call the application entry point.
Routing
Defining the endpoints of an application and the way application responds to the incoming client requests
Definition
-
method: any of the HTTP verbs ( get, post, put, delete)
-
Syntax
router.get('#####', function (req,res) {res.send('About us page')})
-
handler: callback function that gets executed when a matching request type is found on the relevant route.
Functions that get executed every time the server receives a request, defined by an HTTP method and the URL path
-
-
Template engine
-
Pug
-
-
CSS selector element definitions, file includes, mixins, expressions, extensibility
-
-
-
-
-
-
-