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 index.js
. Update api-engine/server/api/device/index.js
, as follows:
'use strict'; var express = require('express'); var controller = require('./device.controller'); var config = require('../../config/environment'); var auth = require...