Skip to content

next('route') not working #3120

Closed
Closed

Description

@kuolun

I copy the documentation code from here
http://expressjs.com/en/guide/using-middleware.html#middleware.application
2016-11-06_09-45-49

and change res.render to res.send
2016-11-06_09-52-38

when I type localhost:3000/user/0
I still get the response of 'regular' on the page

Activity

  1. dougwilson commented on Nov 6, 2016

    @dougwilson
    Contributor

    Hi @kuolun this is a bug with the example code on the website. The conditional is going req.params.id === 0, which will never match, as parameters are strings, not numbers. It should work if you change that to req.params.id === '0'.

  2. added a commit that references this issue on Nov 6, 2016
  3. dougwilson commented on Nov 6, 2016

    @dougwilson
    Contributor

    PR expressjs/expressjs.com#719 recently merged seems to have broken the example. Just change the === to just == or change the 0 to '0'. I made a note to audit that PR for any other examples that may have been broken.

  4. self-assigned this
    on Nov 6, 2016
  5. added
    docs
    on Nov 6, 2016
  6. dougwilson commented on Nov 6, 2016

    @dougwilson
    Contributor

    @kuolun if you're feeling up to it, please feel free to make a PR to fix this in https://github.com/expressjs/expressjs.com :) I just tried to use the online file editor and it is just going crazy on that page so I'm not able to fix it at the moment.

  7. kuolun commented on Nov 6, 2016

    @kuolun
    Author

    OK, I'll try to fix it later :)

  8. LinusU commented on Nov 6, 2016

    @LinusU
    Member

    Yeah this is my fault, sorry about that, fix in expressjs/expressjs.com#731

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

docs

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions