初学node.js遇到express问题

浏览:34日期:2022-09-11

问题描述

//index.jsvar express=require(’express’);var app=express();app.get(’/’,function(req,res){ res.send(’hello express’);});app.get(’/user/:name’,function(req,res){ res.send(’hello ’+req.params.name);});app.listen(3000);

当访问‘localhost:3000/users/fabrice’时为什么页面显示的是‘Cannot GET /users/fabrice’求告知,感谢~~

问题解答

回答1:

你写多了一个s

回答2:

你路由配的是user 访问的却是users←_←

相关文章: