上QQ阅读APP看书,第一时间看更新
How it works...
When navigating to the first URL (http://localhost:1337/), the following message is shown:
A user ID needs to be specified
This is because the middleware function in the router checks if the id was provided in the query, and because it is not, it passes control to the next handler outside of the router with next('router').
On the other hand, when navigating to the second URL (http://localhost:1337/?id=7331), the following message is shown:
You specified a user ID => 7331
That happens because, as an id was provided in the query, the middleware function in the router will pass control to the next handler inside the router with next().