femto

0.0.8 • Public • Published

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

Package Sidebar

Install

npm i femto

Weekly Downloads

7

Version

0.0.8

License

MIT

Last publish

Collaborators

  • gaborsar