femto
v0.0.8
Published
Femto size middleware framework, for minimal APIs.
Downloads
12
Maintainers
Readme
Femto
Femto size middleware framework, for minimal APIs.
Background
Inspired by express and Koa. In fact I needed something like Koa, without generators (to support an older node.js version).
Installation
$ npm install femto
Running unit tests, and JSLint validation
Install dev dependencies.
$ npm install
Run tests.
$ npm test
Check code quality.
$ npm run lint
Example
'use strict';
var femto = require('femto');
var app = femto();
app.use(function (next) {
this.body = { message: 'Hello World' };
next();
});
app.on('error', function (err, context) {
if (context) {
context.body = { error: true };
context.respond();
}
});
app.listen(process.env.PORT || 3000);
process.title = 'femto';
process.on('uncaughtException', function (err) {
console.error('uncaughtException', err.stack);
});
License
MIT