req.path, but also includes the query string suffix.
req.url; // => "/search?q=worlds%20largest%20dogs"
- It is worth mentioning that the URL fragment/hash (e.g. "#some/clientside/route") part of the url is not available on the server. This is an open issue with the current HTTP specification. So if you write an action to redirect from one subdomain to another, for instance, you won't be able to peek at the URL fragment in that action.
- However, if you respond with a 302 redirect (i.e.
res.redirect()) the user agent on the other end will preserve the URL fragment/hash and tack it on to the end of the new redirected URL. In many cases, this is exactly what you want!
Is something missing?
If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails-docs repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.
- Blueprint API
- Command Line Interface
- Response (`res`)
- Waterline (ORM)
- Resourceful PubSub
- Socket Client
We wrote a book!
Get early access to the book
with promotion code: mcneildoc