You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
381 B
19 lines
381 B
2 years ago
|
// 引入express
|
||
|
const express = require("express");
|
||
|
|
||
|
// 创建网站服务器
|
||
|
const app = express();
|
||
|
|
||
|
// 路由
|
||
|
app.get("/",(req,res,next)=>{
|
||
|
console.log(res)
|
||
|
req.name="何琋";
|
||
|
next();//没有next()方法,程序匹配到后就会停止,next()会继续
|
||
|
});
|
||
|
app.get("/",(req,res)=>{
|
||
|
res.send(req.name);
|
||
|
});
|
||
|
|
||
|
|
||
|
// 开启服务器监听
|
||
|
app.listen(80);
|