Node.js connect use()

Description

Node.js connect use()



function echo(req,res,next){
    req.pipe(res);/*w  w  w .j av  a  2  s.  c o  m*/
}

var connect = require('connect');

connect()
    .use('/echo',echo)
    .use(function(req,res,next){
        res.end('Wassup!');
    }).listen(3000);

console.log('server running on port 3000');



PreviousNext

Related