Using express 3.1.0 I have a super simple form:
router.route('/signup')
// (accessed at POST http://localhost:3000/api/signup)
.post(function(req, res) {
var username = req.body.username;
var password = req.body.password;
res.json(
{
message: 'signup success',
username : username,
password : password,
}
);
})
.get(function(req,res){
res.json({message: 'get request from signup'});
});
// REGISTER OUR ROUTES -------------------------------
// all of our routes will be prefixed with /api
app.use('/api', router);