Handling redirects using Express route parameters

I am creating an service that redirects users to Telegram links automatically using route parameters in Express. How can I handle it properly without redirecting back to https://telegram.org? The project that I am talking about this implementation is telegram-launchpad.

@AJHaliliDev2006PH, I don’t understand you properly. If you’re trying to redirect to a webpage from an endpoint, you could do this:

app.get("/redirect", function (req, res) {
    res.redirect('https://website.com');
});

Try this

app.get("/openchat/:username", (req, res) =>
       res.redirect("https://telegram.me/" + req.params.username))
2 Likes

Thank you for your answer, @mishavee!