Skip to content

Instantly share code, notes, and snippets.

@jtroxel
Last active August 29, 2015 14:17
Show Gist options
  • Save jtroxel/5950f90b5fddd11871ab to your computer and use it in GitHub Desktop.
Save jtroxel/5950f90b5fddd11871ab to your computer and use it in GitHub Desktop.
Javascript form post handler
// curl --data-urlencode "name=Thai Green and Sushi" -XPOST localhost:8080/restaurant
routeMatcher.post('/restaurant', function (req) {
console.log("Params: " + req.params());
req.expectMultiPart(true);
req.endHandler(function() {
// The request has been all ready so now we can look at the form attributes
var formAttributes = req.formAttributes();
var name = formAttributes.get('name');
console.log("Name: " + name);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment