Commit 2b3f3f0c authored by andreagerino's avatar andreagerino

...

parent e1acf4b7
...@@ -6,7 +6,7 @@ var mongoClient = require('mongodb').MongoClient; ...@@ -6,7 +6,7 @@ var mongoClient = require('mongodb').MongoClient;
var assert = assert = require('assert'); var assert = assert = require('assert');
// Connection URL // 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 //Use connect method to test the connection to the Server
mongoClient.connect(mongoUrl, function(err, db) { mongoClient.connect(mongoUrl, function(err, db) {
...@@ -38,7 +38,7 @@ router.post('/', function(req, res, next){ ...@@ -38,7 +38,7 @@ router.post('/', function(req, res, next){
var collection = db.collection('resources'); var collection = db.collection('resources');
var resource = req.body; var resource = req.body;
if(Object.keys(resource)>0) { if(Object.keys(resource).length>0) {
collection.insertOne(resource, function (err, r) { collection.insertOne(resource, function (err, r) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment