In express how do I redirect a user to an external url?

You can do

res.redirect('https://app.example.io');

Express docs: https://expressjs.com/en/api.html#res.redirect


    app.get("/where", (req, res) => {

    res.status(301).redirect("https://www.google.com")

})

You need to include the status (301)


The selected answer did not work for me. It was redirecting me to: locahost:8080/www.google.com - which is nonsense.

301 Moved Permanently needs to be included with res.status(301) as seen below.

app.get("/where", (req, res) => {

    res.status(301).redirect("https://www.google.com")

})

You are in the same situation since your back-end is elsewhere.