Express.js | app.set() Function Last Updated : 08 Jan, 2025 Comments Improve Suggest changes Like Article Like Report 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. Syntax:app.set(name, value)Installation of the express module:You can visit the link to Install the express module. You can install this package by using this command.npm install expressAfter installing the express module, you can check your express version in the command prompt using the command.npm version expressAfter that, you can just create a folder and add a file, for example, index.js. To run this file you need to run the following command.node index.jsProject Structure:Filename: index.js javascript const express = require('express'); const app = express(); const PORT = 3000; app.set('title', 'GeeksforGeeks'); app.get('/', (req, res) => { res.send(app.get('title')); }) app.listen(PORT, function (err) { if (err) console.log(err); console.log("Server listening on PORT", PORT); }); Steps to run the program:Make sure you have installed the express module using the following command:npm install expressRun the index.js file using the below command:node index.jsOutput:Console Output:Server listening on PORT 3000Browser Output:Now open the browser and go to http://localhost:3000/, you will get the following output:GeeksforGeeksSo this is how you can use the express app.set() function which assigns a setting name to a value. Comment More infoAdvertise with us Next Article Express app.use() Function G gouravhammad Follow Improve Article Tags : Web Tech Similar Reads Express app.use() Function The app.use() function in Express.js adds middleware to the application's request-processing pipeline. It applies the specified middleware to all incoming requests or to specific routes, allowing you to modify request/response objects, perform operations, or handle errors throughout the application. 3 min read Express app.post() Function The app.post() function in Express.js handles HTTP POST requests to a specific route. It defines a callback function to process incoming data sent via POST, typically used for submitting forms or sending data to a server from clients.Syntax:app.post(path, callback [, callback ...])Arguments:Path: Th 2 min read Express app.listen() Function In Express.js, the app.listen() function is used to start a server and make it listen for incoming requests on a specified port and host. This method is essential for running an Express application as it enables the server to handle HTTP requests from clients (like browsers).Syntax: app.listen([port 3 min read Express app.get() Request Function The app.get() function is used to define routes on your server that handle HTTP GET requests. A GET request is typically used when the client asks the server to send back some information, like retrieving a webpage or data from a database.Itâs an essential part of building websites and APIs, as it a 6 min read Express res.status() Function The res.status() function sets the HTTP status for the response. It is a chainable alias of Nodeâs response.statusCode. Syntax:res.status( code )Parameter: This function accepts a single parameter code that holds the HTTP status code. Return Value: It returns an Object. Steps to create the Express A 2 min read ExpressJS express.json() Function The express.json() function is a built-in middleware in Express that is used for parsing incoming requests with JSON payload. The express.json middleware is important for parsing incoming JSON payloads and making that data available in the req.body or further processing within the routes. Without us 4 min read Like