I have a simple server where i just prints a json to the screen when its posted. This is my code:
/*jslint node:true*/
var express = require('express');
var app = express();
app.use(express.json());
app.use(app.router);
app.post('/event', function (res, req) {
//'use strict';
console.log(req.body);
});
app.listen(3000);
Then i put a JSON to the server with curl:
curl -X POST -H "Content-Type: application/json" -d '{"username":"xyz","password":"xyz"}' http://localhost:3000/event
But the server just prints undefined
What am i doing wrong?