expressjs / expressjs.com

https://expressjs.com
Other
5.23k stars 1.42k forks source link

Feature Request: res.redirect() can redirect to more than just GET routes. #1523

Closed Hari-Shankar-Karthik closed 1 month ago

Hari-Shankar-Karthik commented 1 month ago

Heyy devs of expressjs!

I'm making a simple website and ran into a bit of an issue. Essentially, my website has a list of campgrounds and each campground has a bunch of reviews. A user who is not logged in can still view each campground and the comments on them, but if they try to delete a particular review, they are redirected to the login page. After successful login, I want to redirect to DELETE /campgrounds/:campgroundID/comments/:commentID but unfortunately, res.redirect(...) only alows for GET requests.

This kind of a feature would be super helpful, thanks in advance!!!

P.S. It would be swell if this were possible for POST requests too but the trickier part about that is that the req.body also needs to redirect accordingly.

crandmck commented 1 month ago

@Hari-Shankar-Karthik This repo is for the docs website only.

Please open this issue in https://github.com/expressjs/express ... Unfortunately, I can't move it, otherwise I would.

Thanks!

Hari-Shankar-Karthik commented 1 day ago

Thanks! I moved it.