December 2017
Intermediate to advanced
296 pages
5h 56m
English
Now that we are done with the web app development, we will update the API engine to add the device's API and data service, along with web sockets.
Open api-engine/server/routes.js; we will add two routes here. Update api-engine/server/routes.js, as follows:
'use strict';
var path = require('path');
module.exports = function(app) {
// Insert routes below
app.use('/api/v1/users', require('./api/user'));
app.use('/api/v1/devices', require('./api/device'));
app.use('/api/v1/data', require('./api/data'));
app.use('/auth', require('./auth'));
};
Now, we will add the definitions for these routes. Inside the api-engine/server/api folder, create a new folder named device. Inside the device folder, create a new file named ...