expressjs.com icon indicating copy to clipboard operation
expressjs.com copied to clipboard

Add to docs information on routing URLs

Open dougwilson opened this issue 7 years ago • 1 comments

So there was the issue https://github.com/expressjs/express/issues/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:

  1. 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.
  2. 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 :)

dougwilson avatar Sep 25 '16 04:09 dougwilson

I agree that we need to clarify this in the docs. I can see how it would (did?) lead to some confusion. So your two suggestions @dougwilson seem like a really good place to start.

crandmck avatar Sep 26 '16 17:09 crandmck