📜  node js从请求中获取url - Javascript代码示例

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

代码示例3
const url = require('url');
const express = require('express');

const app = express();
app.use((req, res, next) => {
  const path = url.parse(req.url).path;
  // Do something...
});

const port = 3000;
app.listen(port, console.log(`Listening on port ${port}.`));