Which uses body-parser and simply prints out the body of the request.
This can now be tested with curl by something as simple as:
curl -i -X POST -H "Content-Type: application/json" -d '{"foo": "bar"}' localhost:3000/register
const express = require("express")
+const body_parser = require("body-parser");
const app = express();
+app.use(body_parser.urlencoded({ extended: false }));
+app.use(body_parser.json());
+
app.get('/', function (req, res) {
res.send('Hello World!');
});
+app.post('/register', function (req, res) {
+ console.log(req.body);
+});
+
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
});