Open In App

Express.js Application Complete Reference

Last Updated : 01 Nov, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Express.js is a small framework that works on top of Node.js web server functionality to simplify its APIs and add helpful new features. It makes it easier to organize your application’s functionality with middleware and routing.

Express.js Application Properties:

Properties

Description

Express.js app.locals  Property

The app.locals object has properties that are local variables within the application. These variables are local to the application and are very useful.

Express.js app.mountpath Property

The app.mountpath property contains one or more path patterns on which a sub-app was mounted.

Express.js Application Events:

Event

Description

Express.js mount Event

The mount event is fired on a sub-app when it is mounted on a parent app and the parent app is basically passed to the callback function

Express.js Application Methods:

Methods

Description

Express.js app.all() Function

The app.all() function is used to route all types of HTTP requests. Like if we have POST, GET, PUT, DELETE, etc.

Express.js app.delete() Function

The app.delete() function is used to route the HTTP DELETE requests to the path which is specified as a parameter with the callback functions being passed as a parameter.

Express.js app.disable() Function

The app.disable() function is used to set the boolean setting name to false. It is basically the shorthand for the app.set(name, false).

Express.js app.disabled() Function

The app.disabled() function is used to return the bool values of the setting name. It returns true if the setting name is disabled and returns false if the setting name is not disabled.

Express.js app.enable() Function

The app.enable() function is used to set the boolean value i.e. name to true. It is basically the shorthand for the app.set(name, true) or app.set(name, false).

Express.js app.enabled() Function

The app.enabled() function is used to return the bool values of the setting name. It returns true if the setting name is enabled and returns false if the setting name is not enabled.

Express.js app.engine() Function

The app.engine() function is used to register the given template engine callback as ext. By default the Express itself will require() the engine based on the file extension.

Express.js app.get() Function

The app.get() function routes the HTTP GET Requests to the path which is being specified with the specified callback functions. Basically, it is intended for binding the middleware to your application.

Express.js app.get() request Function

The app.get() function routes the HTTP GET Requests to the path which is being specified with the specified callback functions. Basically, it is intended for binding the middleware to your application.

Express.js app.listen() Function

The app.listen() function is used to bind and listen to the connections on the specified host and port. This method is identical to Node’s http.Server.listen() method.

Express.js app.METHOD() Function

The app.METHOD() function is used to route an HTTP request, where METHOD is the HTTP method of the request, such as GET, PUT, POST, and so on, in lowercase

Express.js app.param() Function

The app.param() function is used to add the callback triggers to route parameters. It is commonly used to check for the existence of the data requested related to the route parameter.

Express.js app.path() Function

The app.path() function returns the canonical path of the app as a string. When mounting advanced apps, the behavior of this approach can become extremely complicated.

Express.js app.post() Function

The app.post() function routes the HTTP POST requests to the specified path with the specified callback functions.

Express.js app.put() Function

The app.put() function routes the HTTP PUT requests to the specified path with the specified callback functions.

Express.js app.render() Function

The app.render() function is used to render the HTML of a view via the callback function. This function returns the HTML in the callback function.

Express.js app.route() Function

The app.route() function returns an instance of a single route, which you can then use to handle HTTP verbs with optional middleware. Use app.route() to avoid duplicate route names (and thus typo errors).

Express.js app.set() Function

The app.set() function is used to assign the setting name to value. You may store any value that you want, but certain names can be used to configure the behavior of the server.

Express.js app.use() Function

The app.use() function is used to mount the specified middleware function(s) at the path which is being specified. It is mostly used to set up middleware for your application.



Previous Article
Next Article

Similar Reads

Express.js express() function Complete Reference
Express.js is a small framework that works on top of Node.js web server functionality to simplify its APIs and add helpful new features. It makes it easier to organize your application’s functionality with middleware and routing. Express.js express() Methods:Method Description Express.js express.json() Function The express.json() function is a buil
1 min read
Express.js Request Complete Reference
Express.js is a small framework that works on top of Node.js web server functionality to simplify its APIs and add helpful new features. It makes it easier to organize your application’s functionality with middleware and routing. Express.js Request Properties:Properties Description Express.js req.app Property The req.app property holds the referenc
4 min read
Express.js Router Complete Reference
Express.js is a small framework that works on top of Node.js web server functionality to simplify its APIs and add helpful new features. It makes it easier to organize your application’s functionality with middleware and routing. Express.js Router Methods: Methods Description Express.js router.all() Function The router.all() function is just like t
1 min read
Express.js Response Complete Reference
Express.js is a small framework that works on top of Node.js web server functionality to simplify its APIs and add helpful new features. It makes it easier to organize your application’s functionality with middleware and routing. Express.js Response Properties:Properties Description Express.js res.app Property The res.app property holds a reference
4 min read
How to expire session after 1 min of inactivity in express-session of Express.js ?
In this article, we will see how to expire the session after 1 min of inactivity in express-session of Express.js. Prerequisites Installation of Node.js on WindowsTo set up Node Project in Editor see here. Requires Modules: npm install express npm install express-session Call API: var session = require('express-session') To expire the session after
2 min read
Express.js express.text() Function
The express.text() function is a built-in middleware function in Express. It parses the incoming request payloads into a string and is based on body-parser. Syntax: express.text( [options] ) Parameter: The options parameter contains various properties like defaultCharset, inflate, limit, verify, etc. Return Value: It returns an Object. Installation
2 min read
Express.js express.raw() Function
The express.raw() function is a built-in middleware function in Express. It parses incoming request payloads into a Buffer and is based on body-parser. Syntax: express.raw( [options] ) Parameter: The options parameter contains various properties like inflate, limit, type, etc. Return Value: It returns an Object. Installation of the express module:
2 min read
What is express-session middleware in Express?
In the Express web application, the express-session middleware is mainly used for managing the sessions for the user-specific data. In this article, we will see the use of express-session middleware for session management in Express with practical implementation. PrerequisitesNode JSExpress JSTable of Content What is express-session Middleware?Step
2 min read
Express JS express.json() Function
The express.json() function is a built-in middleware function in Express. It parses incoming requests with JSON payloads and is based on body-parser.  Syntax: express.json( [options] )Parameters: The options parameter has various properties like inflate, limit, type, etc.  Return Value: It returns an Object.  Steps to Installation the express modul
2 min read
Express express.Router() Function
The express.Router() function is used to create a new router object. This function is used when you want to create a new router object in your program to handle requests.  Syntax: express.Router( [options] )Optional Parameters: case-sensitive: This enables case sensitivity.mergeParams: It preserves the req.params values from the parent router.stric
2 min read
Article Tags :