First of all, I want to apologyze for my english.
I have a Node.js aplication using Express and Jade. My main page has a form, wich allows people to register. I send the data via POST. I have a handler like this:
app.post('/userCreate', user.create);
And:
exports.create = function(req, res){
//creates the user in the database
res.render('./game/main'); //goes to the main game page
}
My problem is that when people registers, and I render the main page, in the URL appears localhost:3000/userCreate. So, if I press F5, all data is sended again via POST, because it's catching '/userCreate' again, and it tries to create another User.
I think an option could be change the URL after creating a user, but I realized that neither 'render' nor 'redirect' methods changes it.
I've been reading about post-redirect-get pattern, but I don't know how to do a get without a form, I mean, via javascript instead of HTML.