Adds integration between controllers.ts and microframework.
-
Install module:
npm install --save microframework-controllers.ts microframework-express
This module depend on microframework-express, so you need to install it too.
-
Simply register module in the microframework when you are bootstrapping it.
import {MicroFrameworkBootstrapper} from "microframework/MicroFrameworkBootstrapper"; import {ExpressModule} from "microframework-express/ExpressModule"; import {ControllersTsModule} from "microframework-controllers.ts/ControllersTsModule"; new MicroFrameworkBootstrapper({ baseDirectory: __dirname }) .registerModules([ new ExpressModule(), new ControllersTsModule() ]) .bootstrap() .then(result => console.log('Module is running. Open localhost:3000')) .catch(error => console.error('Error: ', error));
-
ES6 features are used, so you may want to install es6-shim too:
npm install es6-shim --save
you may need to
require("es6-shim");
in your app. -
Now you can use controllers.ts module in your microframework.
- cover with tests
- add more docs