路由器(称为路由处理,可以理解成导航的意思)
路由器 = 请求方法 + 请求路径 + ss请求处理函数
get:
//当你以get方法请求的时候,执行对应函数
app.get('/',function(req,res){
res.end('hello,world')
})
post:
//当你以post方法请求的时候,执行对应函数
app.post('/',function(req,res){
res.end('hello,world')
})
// 路由其实就是一张表
// 这个表里面有具体的映射关系
// xxx 大厦
// xxx 公司
// 看门的老大爷
// xxx 公司 15 楼 3 号
// 百度公司 4 楼 5 号
// 。。。
// 经过老大爷,你要去哪个公司
// app
// .get(’/login’, 函数)
// .get(’/dsadsa’, 函数)
// .post(’/d/sadsa’, 函数)
// .get(‘dsadsa’, 函数)
//这就是路由表,映射关系