Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/binocarlos/miniware
The smallest middleware implementation in the world
https://github.com/binocarlos/miniware
Last synced: 11 days ago
JSON representation
The smallest middleware implementation in the world
- Host: GitHub
- URL: https://github.com/binocarlos/miniware
- Owner: binocarlos
- License: mit
- Created: 2013-08-18T17:45:02.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-08-26T22:30:57.000Z (about 11 years ago)
- Last Synced: 2024-11-07T02:42:01.044Z (13 days ago)
- Language: JavaScript
- Size: 125 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
miniware
========The smallest middleware implementation in the world
## installation
$ npm install miniware
## usage
A new miniware object represents a stack of functions to cycle through just like connect middleware.
The only different is that req is a pure javascript object and rep becomes **reply** which is a standard node.js callback function.
An example of creating a tiny middleware stack and running a request through it.
```js
var miniware = require('miniware');var tinyapp = miniware();
tinyapp.use(function(req, reply, next){
req.url.should.equal('/hello');
next();
})tinyapp.use(function(req, reply, next){
reply(null, 20);
})tinyapp({
url:'/hello'
}, function(error, result){
result.should.equal(20);
})```
## licence
MIT