bem / bem-express

BEM project-stub with BEMTREE and express
44 stars 20 forks source link

Change req.url -> req.original. It's very important for nested request handlers #55

Closed psdcoder closed 8 years ago

psdcoder commented 8 years ago

If you are use some nested request handlers, for example:

var Router = require('express').Router;
var router = new Router();
var anotherRouter = new Router();

router.get('/', reqHandler);
anotherRouter.get('/', anotherReqHandler);

app
    .use(router)
    .use(anotherRouter)

req.url will be show relative url in this nested route handlers. So we must use req.originalUrl which always show full request url.

tadatuta commented 8 years ago

@psdcoder thank you!