req.url.dirname

STRING, read-only.

Available in all subroutines.

The directories specified in a URL. This will be from the beginning of the URL up to the last /, not including the query string. The last / will not be part of req.url.dirname unless req.url.dirname is / (the root directory).

Examples

In the request www.example.com/1/hello.gif?foo=bar, req.url.dirname will contain /1.

In the request www.example.com/5/inner/hello.gif?foo=bar, req.url.dirname will contain /5/inner.