651940
刚接触node的菜鸟 express最新的版本是把路由配置都转移到routers目录下的index.js中配置了吗? 我在express自动生成的index.js中加入 router.get('/about',function(req,res){ res.end('haha'); }); app.js中没有修改 运行能访问127.0.0.1/about这个路径
但是我还看到要在app.js中添加路由的方案 ,就是这个样子的 app.get('/', routes.index); app.get('/about', function(req, res){ res.send('Hello from the about route!'); }); 但是我发现我自动生成的app.js中没有第一条app.get('/', routes.index); 当我添加第二条的时候也运行不了
我的理解是express重新将路由条目的配置移到了index.js中配置了 求大神们给讲一讲 多谢了