Express req.query Property Last Updated : 11 Apr, 2025 Comments Improve Suggest changes Like Article Like Report The req.query property in Express allows you to access the query parameters from the URL of an incoming HTTP request. Query parameters are typically key-value pairs that are appended to the URL after the "?" symbol, and they are separated by the "&" symbol.Syntax:req.queryParameter: req.query does not require any parameters. It automatically parses and returns an object containing the query parameters from the URL.Steps to Create the Application:Step 1: Initialising the Node App using the below command:npm init -yStep 2: Installing the required packages:npm i expressProject Structure:The updated dependencies in package.json file will look like:"dependencies": { "express": "^5.0.1",}Example 1: Below is the basic example of the req.query property: JavaScript const express = require('express'); const app = express(); const PORT = 3000; app.get('/profile', function (req, res) { console.log(req.query.name); res.send(); }); app.listen(PORT, function (err) { if (err) console.log(err); console.log("Server listening on PORT", PORT); }); Steps to run the program:node index.jsConsole Output:Server listening on PORT 3000Bsrowser Output: Go to http://localhost:3000/profile?name=Gourav :Server listening on PORT 3000GouravExample 2: Below is the basic example of the req.query property: JavaScript const express = require('express'); const app = express(); const PORT = 3000; app.get('/user', function (req, res) { console.log("Name: ", req.query.name); console.log("Age:", req.query.age); res.send(); }); app.listen(PORT, function (err) { if (err) console.log(err); console.log( "Server listening on PORT", PORT ); }); Steps to run the program:node index.jsOutput: make a GET request to http://localhost:3000/user?name=Gourav&age=11:Server listening on PORT 3000Name: GouravAge: 11We have a complete reference article on request methods, where we have covered all the request methods, to check those please go through Express Request Complete Reference article: Comment More infoAdvertise with us Next Article Express req.query Property gouravhammad Follow Improve Article Tags : JavaScript Web Technologies Node.js Express.js Similar Reads Express req.body Property The req.body property contains key-value pairs of data submitted in the request body. By default, it is undefined and is populated when you use a middleware called body-parsing such as express.urlencoded() or express.json(). Syntax:req.bodyParameter: No parameters. Return Value: Object The req.body 4 min read Express.js req.ip Property The req.ip property contains the remote IP address of the request. It is useful when the user wants the IP address of the incoming request made to the application. Syntax:req.ipParameter: No parameter. Return Value: String Installation of the express module:You can visit the link to Install the expr 2 min read Express.js req.route Property The req.route property contains the currently-matched route which is a string. Syntax: req.route Parameter: No parameters. Return Value: Object 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 2 min read Express.js req.protocol Property The req.protocol property contains the request protocol string which is either HTTP or (for TLS requests) https. When the trust proxy setting does not evaluate to false, this property will use the X-Forwarded-Proto header field value if it is present. Syntax: req.protocol Parameter: No parameters. 2 min read Express req.params Property The req.params property is an object containing properties mapped to the named route âparametersâ. For example, if you have the route /student/:id, then the âidâ property is available as req.params.id. This object defaults to {}. Syntax:req.paramsParameter: No parameters. Return Value: Object The re 2 min read Express.js req.app Property The req.app property holds the reference to the instance of the Express application that is using the middleware. Syntax: req.app Parameter: No parameters. Return Value: Object Installation of the express module: You can visit the link to Install the express module. You can install this package b 2 min read Express.js req.secure Property The req.secure property is a Boolean property that is true if a TLS connection is established else returns false. Syntax: req.secure Return Value: It returns a Boolean value either True or False. Installation of the express module: You can visit the link to Install the express module. You can inst 2 min read Express.js req.ips Property The req.ips property contains an array of IP addresses specified in the X-Forwarded-For request header. It returns an array of IP addresses. Syntax: req.ips Parameter: No parameter. Return Value: Array Installation of the express module: You can visit the link to Install the express module. You ca 2 min read Express.js req.xhr Property The req.xhr property returns a true value if the requestâs X-Requested-With header field is XMLHttpRequest which indicates that the request was issued by a client library such as jQuery. Syntax: req.xhr Parameter: No parameters. Returns: True or False. Installation of the express module: You can 2 min read Express.js req.path Property The req.path property contains the path of the request URL. This property is widely used to get the path part of the incoming request URL. Syntax:req.pathParameter: No parameters. Return Value: String Installation of the express module:You can visit the link to Install the express module. You can in 2 min read Like