Allows for adding middleware layers to Node.js servers
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
node_modules/stack
CHANGES.md
README.md
htteepee.js
license.txt
package.json

README.md

htteepee

A teepee you can use for adding layers over your Node HTTP servers!

Allows you to easily add middleware layers to your Node.js server.

npm install htteepee

Uses stack but allowing for a very minor simplification in API usage.

Just change:

    var http = require('http');

...to this:

    var http = require('htteepee');

...and add your middleware functions to the beginning of createServer calls (without need for an extra require and wrapping):

http.createServer(require('./middleware')('Hello'), function (req, res) {

    res.end('World!');

}).listen(1337, '127.0.0.1');

Or, if you want to minimize interference with source files even more, you can require your own file containing the baked in middleware:

var http = require('./baked-in-middleware');

http.createServer(function (req, res) {

    res.end('World!');

}).listen(1337, '127.0.0.1');

...and use the createMiddlewareServer method inside the required middleware file:

var http = require('htteepee');
http.createServer = http.createMiddlewareServer(require('./middleware')('Hello '));
module.exports = http;