Skip to content

Express, Request Parameters

A handy reference to all the request object properties and how to use them

Request parameters

I mentioned how the Request object holds all the HTTP request information.

These are the main properties you'll likely use:

.appholds a reference to the Express app object
.baseUrlthe base path on which the app responds
.bodycontains the data submitted in the request body (must be parsed and populated manually before you can access it)
.cookiescontains the cookies sent by the request (needs the cookie-parser middleware)
.hostnamethe hostname as defined in the Host HTTP header value
.ipthe client IP
.methodthe HTTP method used
.paramsthe route named parameters
.paththe URL path
.protocolthe request protocol
.queryan object containing all the query strings used in the request
.securetrue if the request is secure (uses HTTPS)
.signedCookiescontains the signed cookies sent by the request (needs the cookie-parser middleware)
.xhrtrue if the request is an XMLHttpRequest

How to retrieve the GET query string parameters using Express

The query string is the part that comes after the URL path, and starts with a question mark ?.



Multiple query parameters can be added using &:


How do you get those query string values in Express?

Express makes it very easy by populating the Request.query object for us:

const express = require('express')
const app = express()

app.get('/', (req, res) => {


This object is filled with a property for each query parameter.

If there are no query params, it's an empty object.

This makes it easy to iterate on it using the loop:

for (const key in req.query) {
  console.log(key, req.query[key])

This will print the query property key and the value.

You can access single properties as well: //flavio
req.query.age //35

How to retrieve the POST query string parameters using Express

POST query parameters are sent by HTTP clients for example by forms, or when performing a POST request sending data.

How can you access this data?

If the data was sent as JSON, using Content-Type: application/json, you will use the express.json() middleware:

const express = require('express')
const app = express()


If the data was sent using Content-Type: application/x-www-form-urlencoded, you will need to use the express.urlencoded() middleware:

const express = require('express')
const app = express()

  extended: true

In both cases you can access the data by referencing it from Request.body:'/form', (req, res) => {
  const name =

Note: older Express versions required the use of the body-parser module to process POST data. This is no longer the case as of Express 4.16 (released in September 2017) and later versions.

→ Download my free Express Handbook!



You might be interested in those things I do:

  • Learn to code in THE VALLEY OF CODE, your your web development manual
  • Find a ton of Web Development projects to learn modern tech stacks in practice in THE VALLEY OF CODE PRO
  • I wrote 16 books for beginner software developers, DOWNLOAD THEM NOW
  • Every year I organize a hands-on cohort course coding BOOTCAMP to teach you how to build a complex, modern Web Application in practice (next edition February-March-April-May 2024)
  • Learn how to start a solopreneur business on the Internet with SOLO LAB (next edition in 2024)
  • Find me on X

Related posts that talk about express: