📜  node js http请求获取参数 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:04:18.803000             🧑  作者: Mango

代码示例1
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);