How to get GET (query string) variables in Express.js on Node.js?

Since you’ve mentioned Express.js in your tags, here is an Express-specific answer: use req.query. E.g.

var express = require('express');
var app = express();

app.get("https://stackoverflow.com/", function(req, res){
  res.send('id: ' + req.query.id);
});

app.listen(3000);

Leave a Comment

tech