connect-power-route
v0.0.1
Published
Nodejs connect的路由模块,将express的路由操作习惯抽取出来支持connect
Downloads
5
Readme
connect-power-route
Nodejs connect的路由模块,将express的路由操作习惯抽取出来支持connect
Usage
用法和express一样,如下:
var cpr = require('connect-power-route');
connect = require('connect'),
app = connect();
app.use(cpr(function (router) {
router.get('/', function (req, res, next) {
res.end('index');
});
router.get('/home', function (req, res, next) {
res.end('home');
});
router.get('/home/:id', function (req, res, next) {
res.end('home ' + req.params.id);
});
router.post('/home/:id(\\d{0,4})', function (req, res, next) {
res.end('POST to home');
});
}));