How to get part of the url that comes after the domain name in Node.js

1 Answer

0 votes
const http = require('http');

http.createServer(function(req, res) {
  res.writeHead(200, {'Content-Type': 'text/html'});
  res.write(req.url);
  res.end();
}).listen(8080); 



// To run open http://localhost:8080/query in your web browser

/*
run:

/query

*/

 



answered Feb 27, 2020 by avibootz
edited Mar 11, 2020 by avibootz

Related questions

1 answer 273 views
1 answer 165 views
1 answer 169 views
1 answer 122 views
1 answer 134 views
1 answer 222 views
...