https://www.abc.com/shapes/rectangle?width=10&height=2#conclusion
Component | Example | Also Called |
---|---|---|
scheme | https | protocol |
host | www.abc.com | server id or domain name |
path | /shapes/rectangle | or folder name + web filename |
query | width=10&height=2 | query params or search params |
fragment identifier | conclusion | fragment - often used to "go to" a section heading within a page. |
https://www.abc.com/shapes/rectangle?width=10&height=2
Name | Example | Also Called |
---|---|---|
path | /shapes/rectangle | folder name + web filename |
query | width=10&height=2 | query params or search params |
Component | Description |
---|---|
/ | An empty path "/" might route us to "home" or "index" page processing |
/calc | Any other path will drive us to app specific logic |
Component | Description |
---|---|
width=10&height=2 | The parameters might provide model values |
search=url&results=5 | The parameters might tell us to do a search with a max of five results |
> npm install url-wrapper
UrlWrapper = require('url-wrapper').UrlWrapper;
urlWrapper = UrlWrapper.fromRequest(req);
http://localhost:3000/shapes/rectangle?width=10&height=5
path = urlWrapper.path();
// /shapes/rectangle
query = urlWrapper.query(); w = query.width; //10 h = query['height']; //2