Skip to content

Instantly share code, notes, and snippets.

@reggi
Last active December 10, 2015 17:08
Show Gist options
  • Save reggi/4465538 to your computer and use it in GitHub Desktop.
Save reggi/4465538 to your computer and use it in GitHub Desktop.

Revisions

  1. reggi revised this gist Jan 6, 2013. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,16 @@
    app.use(function(req, res, next) {
    req.url = '/cat' + req.url;
    req.url = req.url.replace("/cat","");
    next();
    });

    app.use(app.router);

    app.get('/cat/foo', function(req, res, next) {
    // `/` and `/cat`
    app.get('/', function(req, res, next) {
    res.send('index');
    });

    // `/hello` and `/cat/hello`
    app.get('/hello', function(req, res, next) {
    res.send('hello');
    });
  2. @defunctzombie defunctzombie created this gist Jan 6, 2013.
    10 changes: 10 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    app.use(function(req, res, next) {
    req.url = '/cat' + req.url;
    next();
    });

    app.use(app.router);

    app.get('/cat/foo', function(req, res, next) {
    res.send('hello');
    });