An Express patch for using streamline.
An Express 3.x patch for using streamline.
$ npm install streamline-express
var express = require"express";var app = require"streamline-express"express;// Both streamline pattern handlers, and normal pattern handlers are supported.appget"/root"setTimeout_ 1000;console.log"/root";ressend"root OK";;appget"/root2"console.log"root 2";ressend"root 2";;appget"/"setTimeout_ 2000;console.log"/";if !reqqueryc next"route";else next;console.log"next /";ressend"OK";;// Middlewares are also supported.appusesetTimeout_ 1000;console.errorerr;;// app.param is supported too.appparam"user"requser = queryUser"..." _;next;;appget"/users/:user"ressendrequser;;
You can use normal patterns as well as streamline patterns for routing, however, if you use (req, res, next) or (err, req, res, next) pattern, beware that the
next argument has to be named next.
(The MIT License)
Copyright (c) 2013 Seth Yuan
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.