connect-friendwares

v0.0.2
A connect helper so that middlewares can see their friends.
connect middlewares friends

connect-friendwares

Build Status

A connect helper so that middlewares can see their friends.

Why?

I wanted to make it quick and easy to detect from a middleware whether it is being used by Express or not. This would allow you to give an error message or reduced functionality unless the correct middlewares are setup.

Usage

var connect     = require('connect'),
    http        = require('http'),
    friendwares = require('connnect-friendwares');

var app = connect()
  .use(require('compression')())
  .use(function (req, res) {
    if (friendwares(app.stack).has('compression')) {
      console.log("Compression middleware exists in the stack.");
    }
    res.end('Hello from Connect!\n');
  });

http.createServer(app).listen(3000);

Metadata

Downloads

Maintainers