0
我想在Express上創建基於MVC的架構,以覆蓋Express路由器。覆蓋Express路由器
考慮以下爲例:
// usual express router
var userRouter = require('express').Router();
userRouter.get("/",function(req, res, next){
//.....
});
userRouter.post("/",function(req, res, next){
//.....
});
app.use('/users', userRouter);
//routes.js
module.exports = function(app){
var userRouter = app.Router();
userRouter.get('/', {controller: 'User', action: 'show'});
userRouter.post('/', {controller: 'User', action: 'new'});
app.use('/users', userRouter);
};
所以,我必須再次實現路由器就像我的控制器分析功能明確?