In the first article in this two-part series on the Internet of Things (IoT) with Node.js and Intel Galileo Gen 2, I explained how to prepare the board to work with Intel XDK IoT Edition; and I reviewed basic use of the MRAA library.
In this article, I explain how to use Node.js to add REST interfaces and real-time notifications that enable an IoT board to communicate with other applications.http://www.embedded.com/electronics-news/4436305/Building-an-IoT-Project-with-Intel-Galileo-and-Node-js
Providing a REST API .
The following lines show a new version of main.js that uses the HTTP module to create an HTTP server that listens on port 1337 and provides a response for the GET method with a specific URL. (For all this work, I will continue using Intel XDK IoT Edition as the IDE. I described its use in the previous article. )