Answers for "get parameters from req javascript"

-2

node js http request get parameters

const http = require('http');
const url = require('url');

http.createServer(function (req, res) {
  const queryObject = url.parse(req.url,true).query;
  console.log(queryObject);

  res.writeHead(200, {'Content-Type': 'text/html'});
  res.end('Feel free to add query parameters to the end of the url');
}).listen(8080);
Posted by: Guest on June-14-2020
1

req.params

params. An object containing parameter values parsed from the URL path. For example if you have the route /user/:name , then the "name" from the URL path wil be available as req.params.name .
Posted by: Guest on January-31-2021

Code answers related to "get parameters from req javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language