Git Product home page Git Product logo

Comments (8)

ForbesLindesay avatar ForbesLindesay commented on May 2, 2024

Does this also work in page.js ? if so, needs documenting...

from expressjs.com.

tj avatar tj commented on May 2, 2024

nope

from expressjs.com.

ForbesLindesay avatar ForbesLindesay commented on May 2, 2024

never mind, might be a nice feature some time.

from expressjs.com.

defunctzombie avatar defunctzombie commented on May 2, 2024

Is this still a thing?

from expressjs.com.

jonathanong avatar jonathanong commented on May 2, 2024

imo this is a weird feature. easier just to have users change req.url or something.

from expressjs.com.

ForbesLindesay avatar ForbesLindesay commented on May 2, 2024

It's actually really useful, and nothing like changing req.url. The use case is something like the following:

app.get('/', user.can('view admin home page').here, function (req, res, next) {
  res.render('admin-home-page');
});
app.get('/', function (req, res, next) {
  res.render('normal-home-page');
});

The user.can('view admin home page').here acts as a guard for that handler, but allows other handlers further down the chain to still work if need be.

from expressjs.com.

defunctzombie avatar defunctzombie commented on May 2, 2024

A regular next() would do the same thing here now.
On Mar 6, 2014 5:42 AM, "Forbes Lindesay" [email protected] wrote:

It's actually really useful, and nothing like changing req.url. The use
case is something like the following:

app.get('/', user.can('view admin home page').here, function (req, res, next) {
res.render('admin-home-page');});app.get('/', function (req, res, next) {
res.render('normal-home-page');});

The user.can('view admin home page').here acts as a guard for that
handler, but allows other handlers further down the chain to still work if
need be.

Reply to this email directly or view it on GitHubhttps://github.com//issues/48#issuecomment-36843605
.

from expressjs.com.

hacksparrow avatar hacksparrow commented on May 2, 2024

After almost two years, we can finally close this.
560f587

from expressjs.com.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.