update route name and handle empty body

This commit is contained in:
Paul Trowbridge 2019-02-14 18:47:59 +00:00
parent d4a954750a
commit 61e7cd81f4

View File

@ -33,9 +33,8 @@ server.get('/list_sources', function (req,res) {
Postgres.FirstRow(sql,[],res);
})
server.get('/rep_list', bodyParser.json(), function (req,res) {
server.get('/monthly_orders', bodyParser.json(), function (req,res) {
//console.log(JSON.stringify(req.body));
var w = "";
var c = 1;
var args = [];
@ -51,6 +50,10 @@ server.get('/rep_list', bodyParser.json(), function (req,res) {
args.push(req.body[i]);
c = c + 1;
};
if (c == 1) {
res.send("no body was sent");
return;
}
//console.log(w);
//console.log(args);
w =
@ -81,6 +84,6 @@ server.get('/rep_list', bodyParser.json(), function (req,res) {
//res.json("hi")
})
server.get('/', (req,res) => res.send('its running yay 🎡'))
server.get('/', (req,res) => res.send('node.js express is running: 🎉'))
server.listen(3000,() => console.log('started'))