Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save matthewrevell/70c04f2a6e2cececbc40 to your computer and use it in GitHub Desktop.
Save matthewrevell/70c04f2a6e2cececbc40 to your computer and use it in GitHub Desktop.
// 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