Skip to Content
Practical Internet of Things with JavaScript
book

Practical Internet of Things with JavaScript

by Arvind Ravulavaru
December 2017
Intermediate to advanced
296 pages
5h 56m
English
Packt Publishing
Content preview from Practical Internet of Things with JavaScript

Updating the API engine

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Test-Driving JavaScript Applications

Test-Driving JavaScript Applications

Venkat Subramaniam
Web Caching and Replication

Web Caching and Replication

Michael Rabinovich, Oliver Spatscheck

Publisher Resources

ISBN: 9781788292948Supplemental Content