Skip to content

Instantly share code, notes, and snippets.

@alexlafroscia
Created July 17, 2014 18:39
Show Gist options
  • Save alexlafroscia/c09349ebd48f22857dc2 to your computer and use it in GitHub Desktop.
Save alexlafroscia/c09349ebd48f22857dc2 to your computer and use it in GitHub Desktop.
Quick and Dirty Node POST Receiver
/* Simple Node POST Server
* =================================
* Desc: Prints out the JSON that it receives to the root of the Server
* Auth: Alex LaFroscia (@alexlafroscia)
*
*
* How to Use:
* -------------------
* Run `node post-receiver.js` from the root of the directory
*
*
* Required NPM packages:
* -------------------
* - express
* - body-parser
*
*/
var express = require('express');
var app = express();
var bodyParser = require('body-parser')
app.use( bodyParser.json() );
app.post('/', function(req, res){
console.log(req.body);
res.send(200);
});
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment