diff --git a/routes/storage.js b/routes/storage.js index 0da21d2d46bf8db2380e538f71930946793cf90a..139d81fcfd1f3d4ebfe59e2956a28e058a7c74b7 100644 --- a/routes/storage.js +++ b/routes/storage.js @@ -6,7 +6,7 @@ var mongoClient = require('mongodb').MongoClient; var assert = assert = require('assert'); // Connection URL -var mongoUrl = 'mongodb://icarus:icarus@webdev.ewlab.di.unimi.it:27017/icarus'; +var mongoUrl = 'mongodb://icarus:icarus@localhost:27017/icarus'; //Use connect method to test the connection to the Server mongoClient.connect(mongoUrl, function(err, db) { @@ -38,7 +38,7 @@ router.post('/', function(req, res, next){ var collection = db.collection('resources'); var resource = req.body; - if(Object.keys(resource)>0) { + if(Object.keys(resource).length>0) { collection.insertOne(resource, function (err, r) {