خرید بک لینک

Vote count: 0

I'm using Node.js with Express framework. I have an endpoint /register which renders form on GET. On POST it validates the input and then renders the same view, with any possible errors. On success it redirects.

My problem is that when I reload the page the browser remembers my previous input. It doesn't even prompt the alert, telling me that refreshing will resubmit the form (I'm using Chrome). In similar question I've found this patte: https://en.wikipedia.org/wiki/Post/Redirect/Get, but I don't really know how to implement this in Express (keep in mind that I still need to print these error messages after redirect and req.flash doesn't really help since it stores only strings, not arrays). I tried changing the POST endpoint to /register/process but it was the same.

If I really need to use res.redirect how do I store this data? Or is there any better approach?

asked 45 secs ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 25 فروردين 1395 ساعت: 6:21

صفحه بندی