implement app.route()

Esse commit está contido em:
Roman Shtylman
2014-02-23 11:31:43 -05:00
commit 0719e5f402
2 arquivos alterados com 22 adições e 0 exclusões
+2
Ver Arquivo
@@ -214,6 +214,8 @@ app.use = function(route, fn){
*/
app.route = function(path){
this.lazyrouter();
return this._router.route(path);
};
/**
+20
Ver Arquivo
@@ -0,0 +1,20 @@
var express = require('../')
, request = require('./support/http')
describe('app.route', function(){
it('should return a new route', function(done){
var app = express();
app.route('/foo')
.get(function(req, res) {
res.send('get');
})
.post(function(req, res) {
res.send('post');
});
request(app)
.post('/foo')
.expect('post', done);
});
});