Is there any straightforward way to get URL path segment without any additional data (url parameters, css '#', etc.)
for example:
full URL: http://example.com/panel/list
path segment I want to get: /panel/list
full URL: http://example.com/panel/list?user=joe
path segment I want to get: /panel/list
full URL: http://example.com/panel/list#header
path segment I want to get: /panel/list
And any other combination of data that is not path segment of my URL
I think you can use req.baseUrl + req.path
.
And for full URL use req.originalUrl.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With