Guilherme Salomé Guilherme Salomé - 1 year ago 54
Node.js Question

GET a website url when routing

Sorry, my vocabulary is very limited, any help clarifying this question is deeply appreciated.

I'm building a server using Nodejs and Express, it has a route like

. I access the value passed on the url by using
. This works well for simple strings, like
, however, if I pass a website url, like
, then it won't be routed to

Question: how can I pass a website url and access it with Node/Express?

Edit: I am trying to use the GET method, and apparently a way to solve this problem is through Wildcards/Regex.

Thank you very much for helping!

Answer Source

The solution that worked for me was Regex. Instead of routing as /new/:url, I used:


So that if is given as a parameter:

req.params.url = ""
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download