mvc
安装
npm
npm install node-web-mvc
yarn
yarn add node-web-mvc
使用
express
const { Registry, ControllerFactory,AreaRegistration,Routes } = require('node-mvc');
ControllerFactory.registerControllers(path.resolve('api/controllers'));
AreaRegistration.registerAllAreas(path.resolve('api/areas'));
Routes.mapRoute('{controller}/{action}', { controller: 'Home', action: 'index' });
app.use(Registry.launch());
koa
const { Registry, ControllerFactory,AreaRegistration,Routes } = require('node-mvc');
ControllerFactory.registerControllers(path.resolve('api/controllers'));
AreaRegistration.registerAllAreas(path.resolve('api/areas'));
Routes.mapRoute('{controller}/{action}', { controller: 'Home', action: 'index' });
app.use(Registry.launchKoa());