You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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'.
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.
Activity
dougwilson commentedon Nov 6, 2016
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 toreq.params.id === '0'.Follow standard style
dougwilson commentedon Nov 6, 2016
PR expressjs/expressjs.com#719 recently merged seems to have broken the example. Just change the
===to just==or change the0to'0'. I made a note to audit that PR for any other examples that may have been broken.dougwilson commentedon Nov 6, 2016
@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.
kuolun commentedon Nov 6, 2016
OK, I'll try to fix it later :)
LinusU commentedon Nov 6, 2016
Yeah this is my fault, sorry about that, fix in expressjs/expressjs.com#731