Created
March 31, 2015 13:21
-
-
Save matthewrevell/70c04f2a6e2cececbc40 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Now we need to create a route to handle the POST | |
app.post('/', urlEncodedParser, function (req, res) { | |
if (!req.body) return res.sendStatus(400); | |
// Convert our form input into JSON ready to store in Couchbase | |
var jsonVersion = JSON.stringify(req.body); | |
// Save it into Couchbase with keyname user | |
bucket.upsert('user', jsonVersion, function (err, response){ | |
if (err) { | |
console.log('Failed to save to Couchbase', err); | |
return; | |
} else { | |
res.send('Saved to Couchbase!'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment