express-konnector
v0.0.3
Published
Express connector for Konsserto framework
Downloads
58
Readme
Express-konnector
An express connector for Konsserto framework.
Usage
This piece of code will make multiple tasks :
- Registering stuff in injector that will be accessible from inside the express-konnector (like controller declaration for example)
- Load the express routes with the RouteParser and resolve the routes controller using the injector
- Load the routes directly into the express application
import expressKonnector from 'express-konnector'
import express from 'express'
import { Injector, Dependency } from 'deepin'
import RouteParser from 'route-parser'
const injector = Injector.createAndResolve([
new Dependency('Test', {useValue:'Test value'})
])
const routeParser = new RouteParser(['/path/to/route.yml'])
/**
* Create a new application
*/
const app = express()
app.use(configs())
expressKonnector(app, injector, routeParser)
app.start(3000)