osr
Version:
osr
27 lines (21 loc) • 620 B
JavaScript
var Route = function(name){
this.name = name;
this.routes = {all:[],get:[],post:[],delete:[]};
}
Route.prototype.all = function(path,fn){
this.routes.all.push({path:path,fn:fn});
}
Route.prototype.get = function(path,fn){
this.routes.all.push({path:path,fn:fn});
}
Route.prototype.post = function(path,fn){
this.routes.all.push({path:path,fn:fn});
}
Route.prototype.delete = function(path,fn){
this.routes.all.push({path:path,fn:fn});
}
Route.prototype.inject = function(osr){
osr._routes[this.name] = this;
return this;
}
module.exports = exports = Route;