1.0.8 • Published 8 years ago
mrl v1.0.8
mrl
light-weight HTTP framework for node.js to make web applications and APIs more enjoyable to write; who can use express's middlewave and kos's middlewave
Code is for reference only, not for the production environment! 代码仅供参考,切勿用于生产环境!
Installation
$ npm install mrl
Example
var mr = require('mrl');
var app = mrl();
app.use(function*(next){
this.body = 'hello';
yield next;
});
app.use(function(req,res,next){
if(this.body!='hello'){
res.end('hi');
return;
}
next();
});
app.use(function(req,res){
console.log(this.body);//hello
res.end('hello world!');
});
app.listen(3000,function(){
console.log('listen on port:',3000);
});
License
MIT