Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
demo_url.js:
var url = require('url'); var adr = 'http://localhost:8080/default.htm?year=2017&month=february'; //Parse the address: var q = url.parse(adr, true); /*The parse method returns an object containing url properties*/ console.log(q.host); console.log(q.pathname); console.log(q.search); /*The query property returns an object with all the querystring parameters as properties:*/ var qdata = q.query; console.log(qdata.month);
C:\Users\My Name>node demo_url.js
localhost:8080
/default
?year=2017&month=february
february