Skip to content

Commit

Permalink
💄 Route handlers are now named (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainEstevez committed Apr 7, 2017
1 parent e41424b commit ea60504
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = class Route {
* @default null
*/
get handler() { return null; }

get routerType() { return this._routerType; }

/**
Expand Down Expand Up @@ -86,14 +86,14 @@ module.exports = class Route {

case Restypie.RouterTypes.EXPRESS:
/* istanbul ignore next */
return function (req, res, next) {
return function restypieRouteHandler (req, res, next) {
req.bundle = new Restypie.Bundle({ req, res, url });
return next();
};

case Restypie.RouterTypes.KOA_ROUTER:
/* istanbul ignore next */
return function *(next) {
return function * restypieRouteHandler (next) {
if (this.request.body) this.req.body = this.request.body;
this.req.params = this.params; // Copy params so that we don't have to parse them
this.req.query = this.query;
Expand All @@ -102,7 +102,7 @@ module.exports = class Route {
};
}
}

_setRouterType(routerType) {
Restypie.assertSupportedRouterType(routerType);
this._routerType = routerType;
Expand Down Expand Up @@ -142,4 +142,4 @@ module.exports = class Route {

}

};
};

0 comments on commit ea60504

Please sign in to comment.