Nodejs之实现路由和中间件

我们首先起一个服务 const http = require("http"); const url = require("url"); http .createServer(function(req, res) { const pathname = url.parse(req.url).pathname; res.end(req.method.toLowerCase() + ": " + pathname); }) .listen(3000); 访...