THE WORLD'S LARGEST WEB DEVELOPER SITE

Node.js Query String Module

❮ Built-in Modules


Example

Parse a query string into an object, and extract the year property:

var querystring = require('querystring');
var q = querystring.parse('year=2017&month=february');
console.log(q.year);
Run example »

Definition and Usage

The Query String module provides a way of parsing the URL query string.


Syntax

The syntax for including the Query String module in your application:

var querystring = require('querystring');

Query String Methods

Method Description
escape() Returns an escaped querystring
parse() Parses the querystring and returns an object
stringify() Stringifies an object, and returns a query string
unescape() Returns an unescaped query string

❮ Built-in Modules