So there was the issue expressjs/express#3088 filed in Express recently regarding confusion about how Express handles routing when the incoming URL is a full URL instead of just the path (i.e. GET http://localhost/ HTTP/1.1 vs GET / HTTP/1.1). I browsed around through the docs and it doesn't seem super clear.
I can see two possible ways to enhance the documentation around this:
- In the routing section, we can probably call out that the
path argument matches only against the pathname part of the request URL and nothing else. This is an indirect answer to a lot of the matching questions like the above as well as calling out that no, it does not match against the query part, host part, etc.
- If we want to, we can explicitly call out that any scheme, auth, host, querystring, etc. in the request URL are ignored during the routing. Perhaps we can show an example of
http://localhost/foo?bar=1 only routing against the /foo part.
Anyway, those are some of my initial thoughts on the docs from that issue :)
So there was the issue expressjs/express#3088 filed in Express recently regarding confusion about how Express handles routing when the incoming URL is a full URL instead of just the path (i.e.
GET http://localhost/ HTTP/1.1vsGET / HTTP/1.1). I browsed around through the docs and it doesn't seem super clear.I can see two possible ways to enhance the documentation around this:
pathargument matches only against thepathnamepart of the request URL and nothing else. This is an indirect answer to a lot of the matching questions like the above as well as calling out that no, it does not match against the query part, host part, etc.http://localhost/foo?bar=1only routing against the/foopart.Anyway, those are some of my initial thoughts on the docs from that issue :)