app.routes = {
get:[
{ path:'/',
method:'get',
callbacks:[routes.index],
keys:[],
regexp:/^\/\/?$/i },
{ path:'/users/:id',
method:'get',
callbacks:[user.list],
keys:[Object],
regexp:/^\/users\/(?:([^\/]+?))\/?$/i }
],
post:[
{ path:'/login',
method:'post',
callbacks:[login.login],
keys:[],
regexp:/^\/login\/?$/i }
] };
我是上面这样写的,不好用,所有页面都是404,按照下面写法可以用,为什么?
app.get('/', routes.index);
app.get('/users/:id', user.list);
app.post('/login', login.login);