micron

Minimalist extensions to the Node.js core HTTP server.

Micron is a tiny module which provides a few simple extensions to the Node.js core HTTP API. Most notably, Micron provides an un-buffered middleware pattern modeled after the function (req, res, next) convention and basic extensions to the request and response objects.

The goal of Micron is to provide as thin a layer as possible on top of the core HTTP API as to reduce boilerplate for many applications, but without adding bloat or destroying desirable features such as streams as in the case of Connect / Express.

npm install micron
var micron = require('micron');
 
// Create the server and define the request listener 
var server = micron.createServer(function (reqres) {
    res.json(req.headers);
});
 
// Add some middleware 
server.use(function (reqresnext) {
    req.headers['x-server'] = 'Hello from micron';
    next();
});
 
// Start listening for requests 
server.listen(8080);