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 275 views
1 answer 168 views
1 answer 172 views
1 answer 127 views
1 answer 141 views
1 answer 227 views
...