1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-04-24 13:48:49 +08:00

Merge pull request #21 from drasko/master

Add license to package.json. Correct HTTP headers.
This commit is contained in:
Nikola 2015-10-12 20:48:08 +02:00
commit b520216351
2 changed files with 8 additions and 5 deletions

View File

@ -11,8 +11,7 @@ router.route('/')
/** Create a device (accessed at POST http://localhost:8080/devices) */ /** Create a device (accessed at POST http://localhost:8080/devices) */
.post(function(req, res) { .post(function(req, res) {
console.log("req.headers['mainflux_uuid']", req.headers['mainflux_uuid']); console.log("req.headers['x-auth-token'] = ", req.headers['x-auth-token']);
console.log("req.headers['mainflux_token']", req.headers['mainflux_token']);
var device = new Device(); // create a new instance of the Device model var device = new Device(); // create a new instance of the Device model
device.name = req.body.name; // set the device's name (comes from the request) device.name = req.body.name; // set the device's name (comes from the request)
@ -22,13 +21,16 @@ router.route('/')
if (err) if (err)
res.send(err); res.send(err);
res.json({ message: 'Device created!' }); res.json(device);
}); });
}) })
/** Get all the devices (accessed at GET http://localhost:8080/devices) */ /** Get all the devices (accessed at GET http://localhost:8080/devices) */
.get(function(req, res) { .get(function(req, res) {
console.log("req.headers['x-auth-token'] = ", req.headers['x-auth-token']);
Device.find(function(err, devices) { Device.find(function(err, devices) {
if (err) if (err)
res.send(err); res.send(err);
@ -69,7 +71,7 @@ router.route('/:device_id')
if (err) if (err)
res.send(err); res.send(err);
res.json({ message: 'Device updated!' }); res.json(device);
}); });
}) })
@ -83,7 +85,7 @@ router.route('/:device_id')
if (err) if (err)
res.send(err); res.send(err);
res.json({ message: 'Successfully deleted' }); res.json(device);
}); });
}); });

View File

@ -6,6 +6,7 @@
"type": "git", "type": "git",
"url": "https://github.com/Mainflux/mainflux" "url": "https://github.com/Mainflux/mainflux"
}, },
"license": "Apache-2.0",
"dependencies": { "dependencies": {
"express": "~4.0.0", "express": "~4.0.0",