Package Exports
- @bauble/routing
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@bauble/routing) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@bauble/routing
Controllers and route decorators for express
Example
@Controller('api/test')
class TController {
// GET /api/test
@Route(HttpMethod.GET, '/')
index(req: express.Request, res: express.Response) {
res.send('Hello World')
}
// GET /api/test/v2
@Route(HttpMethod.GET, '/v2')
index2(req: express.Request, res: express.Response) {
res.send('Hello World, v2')
}
}
@Controller()
class TController2 {
// GET /test
@Route(HttpMethod.GET, 'test')
index(req: express.Request, res: express.Response) {
res.send(req.query)
}
}
let app = express()
app.listen(3000, () => {
console.log("listening...")
// Register the app. Controllers and routes will not work without this!
Bauble.start(app)
})