New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-web-mvc

Package Overview
Dependencies
Maintainers
1
Versions
183
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-web-mvc

> npm

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
68
increased by1260%
Maintainers
1
Weekly downloads
 
Created
Source

mvc

安装

npm


npm install node-web-mvc

yarn


yarn add node-web-mvc

使用

express

const { Registry, ControllerFactory,AreaRegistration,Routes } = require('node-mvc');

//注册api/controllers目录下的所有controller
ControllerFactory.registerControllers(path.resolve('api/controllers'));
//注册所有MVC域(Area)
AreaRegistration.registerAllAreas(path.resolve('api/areas'));

// 或者可以设置自定义的控制器工厂
// ControllerFactory.defaultFactory = new ControllerFactory();

//设置默认路由
//推荐:最好把以下代码放到所有路由配置的最后,以降低其优先级,防止吞掉其他指定的路由
Routes.mapRoute('{controller}/{action}', { controller: 'Home', action: 'index' });

// 启动Mvc  
app.use(Registry.launch());

koa

const { Registry, ControllerFactory,AreaRegistration,Routes } = require('node-mvc');

//注册api/controllers目录下的所有controller
ControllerFactory.registerControllers(path.resolve('api/controllers'));
//注册所有MVC域(Area)
AreaRegistration.registerAllAreas(path.resolve('api/areas'));

// 或者可以设置自定义的控制器工厂
// ControllerFactory.defaultFactory = new ControllerFactory();

//设置默认路由
//推荐:最好把以下代码放到所有路由配置的最后,以降低其优先级,防止吞掉其他指定的路由
Routes.mapRoute('{controller}/{action}', { controller: 'Home', action: 'index' });

// 启动Mvc  
app.use(Registry.launchKoa());

Keywords

FAQs

Package last updated on 29 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc