Skip to content

Instantly share code, notes, and snippets.

@seanbollin
Created December 9, 2010 22:15
Show Gist options
  • Save seanbollin/735423 to your computer and use it in GitHub Desktop.
Save seanbollin/735423 to your computer and use it in GitHub Desktop.
app.get('/game', function(req, res) {
console.log("request /game");
roomProvider.findById(1, function(error, docs){
currentRoom = docs;
res.render('games_index.haml', {
locals: {
title: 'RubyMUD',
room: exit_generator(docs),
isGameLayout: true
}
});
})
});
app.post('/registration', function(req, res) {
console.log(req.body);
var u = new model.User();
u.characterName = req.body.characterName;
u.email = req.body.email;
u.password = req.body.password;
u.characterClass = req.body.characterClass;
u.characterRace = req.body.characterRace;
u.save(function(){
req.authenticate(['someName'], function(error, authenticated) {
res.redirect('/game');
});
});
});
@walteryu
Copy link

cool, get and post requests in node?

@seanbollin
Copy link
Author

Yeah. Posted it for the creator of express - he was helping me with a problem I had. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment