Supports Express 2 through 5.
var express = ;var app = ;// ...app;// ...app;
npm install express-streamline --save
You can either
require() Express normally and then patch it:
var express = ;;
require() this module, which returns the patched Express for
var express = ;
Then, you can write any and all Express handlers in Streamline syntax by just
// middleware handlers:app;app;// route handlers:app;app;// ... (all verbs supported)// error handlers:app;
By default, Streamlined middleware handlers will continue to the
middleware, while Streamlined route and error handlers won't.
This is generally what you want, but you can specify whether
called by explicitly returning
// middleware to blacklist banned IP addresses,// but allow all other requests to pass through:app;
This module also supports Streamline's smart global context. If present, the context is reset for every request, so data can safely be added to it without affecting other requests.
var globals = ;// middleware to set a global `locale` variable on every request,// for lower-level modules to use:app;
If you run into any issues, file a bug!
MIT. © 2012-2015 Aseem Kishore.
streamline-express for the
inspiration and motivation.
streamline-express has supported Express 3 for longer than this module, and
it currently also supports more advanced Express 3 features (like passing
multiple Streamlined handlers to the same
I believe this module has a cleaner API and more robust implementation,
however, but I'm biased. =) Both modules get the job done just fine!