URLs
What is a URL
URL stands for Uniform Resource Locator.
URL is an address of a resource on the internet.
- Resource can be things like a webpage or assets (e.g. image or video).
Anatomy of a URL
http://www.example.com:80/user?ref=Sam http // protocol/scheme www.example.com // domain name 80 // port /user // path ? // query ref=Sam // parameter
URI vs URL
URI (identify) and URL (locate).
- Locators are also identifiers.
- Every URLis aURI, but everyURIs are notURLs.
What is a route
Routing refers to how an application’s endpoints (URIs) respond to client requests.
You define routing using methods of the Express app object that correspond to HTTP methods.
Impact of trailing slash in a URI
Trailing slash makes route a different URL.
# two different routes /api/service_name /api/service_name/
Trailing slash potentially leads to 307 Temporary Redirect error.