Express Common Controller
This is a common controller for using express
Current Status:
Installation
$ npm|yarn install express-common-controller
Usage
First step:
Create a controller inherit BaseController.
- HelloController.js
const BaseController = BaseController; {} HelloControllerprototype = ; HelloControllerprototype { this;}; moduleexports = HelloController;
Or Using ES6 style
; { super; } { this; } ;
Second step:
Create a router config like this:
const path = ;const ExpressCommonControllerRouter = default; const router = ; routerpath = path; router; moduleexports = router;
NOTE ExpressCommonControllerRouter
based on ExpressCommonRouter
.
More info please refer to here:express-common-router
Third step:
Using routes config in server.js
const express = ;const routes = ;const app = ; app; app;
Config your routes.
This component support all methods which supported by express
.
About the details of config route, please refer to here: Express Router
License
express-common-controller is released under the MIT license.