I’ve created a function that can build nested urls like so. I was wondering if there existed a more mainstream library to build urls / uris like this. I’d rather use a standard.
utility.urlConstruct({
"scheme": "https://",
"domain": "domain.com",
"path": "/login",
"query":{
"user":"thomasreggi",
"from":utility.urlConstruct({
"scheme": "https://",
"domain": "redirect.com",
"path": "/funstuff",
}),
}
});
Spits out
https://domain.com/login?user=thomasreggi&from=https%3A%2F%2Fredirect.com%2Ffunstuff
The correct answer is node’s built in URL library.
Specifically