NodeJs How to Get GET Query String in Express.js

Posted on September 13, 2019 at 9:17 am

With Express.js you can use req.query like this:

var express = require('express');
var app = express();
 
app.get('/', function(req, res){
  res.send('id: ' + req.query.id);
});
 
app.listen(8088);

It handles the $_GET[‘id’] GET query, i.e:

http://127.0.0.1:8088/?id=123

Receive updates via email

Other Posts

Updated Posts