0.1.0 • Published 6 years ago

smuggler v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Smuggler

An expressjs middleware to handle with responses in an elegant way

This library is heavily inspired by KeystoneJS's View class.

If you often find yourself struggling with callbacks and middlewares on your routes, this is for you. Smuggler is all about providing a simple api for asyncronous responses.

Getting started

npm install smuggler --save
var express = require('express');
var smuggler = require('smuggler');

var app = express();

app.use(smuggler());

...

Example

app.get('/', function (req, res, next) {
	res.on('init', function (cb) {
		cb(null, new Date().getTime());
	}, 'time');

	res.on('get', 'full', function (cb) {
		cb(null, {
			name: 'John',
			email: 'jonny@example.com'
		})
	}, 'fullInfo');

	res.render('index', next);
});

To be improved...

0.1.0

6 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago