Package Exports
- bragg-router
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 (bragg-router) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
bragg-router 
Router middleware for bragg.
Install
$ npm install --save bragg-router
Usage
const app = require('bragg')();
const router = require('bragg-router')();
router.get('/', function () {
this.body = 'Home';
});
router.get('/user/{id}', function () {
this.body = 'Retrieve user with id ' + this.request.params.id;
});
app.use(router.routes());
exports.handler = app.listen();
Mapping template
In order for you to use the router, you will have to add extra properties to your mapping template.
{
"resource-path": "$context.resourcePath",
"http-method": "$context.httpMethod"
}
Bragg will detect these properties and expose them as path
and method
properties in the middlewares.
License
MIT © Sam Verschueren