url浅析
程序员文章站
2022-07-12 14:58:12
...
路径解析
const http = require('http');
const url = require('url');
const server = http.createServer((req, res) => {
let path = url.parse(req.url);
res.write("url is" + req.url + "\n");
res.end("PATH is" + path.pathname + "\n");
});
let port = process.env.NODE_PORT || 8080;
server.listen(port, () => {
console.log("Server started at: " + port);
});
上一篇: uniapp 条件渲染