Node express post insert with return

npm install body-parser needed.

var bodyParser = require('body-parser')
app.use( bodyParser.json() ); // to support JSON-encoded bodies
app.use(bodyParser.urlencoded({ // to support URL-encoded bodies
extended: true
}));

app.post('/register', function (req, res) {

MongoClient.connect(url, function(err, db) {
if (err) throw err;
var dbo = db.db("fcparser");
var usr = { username: req.body.nick, email: req.body.email, password: req.body.password };

dbo.collection('users').insert(req.body, function (err, result) {
if (err)
res.send('Error');

else
res.send('true');

db.close();

});

});
})