Book Image

Intel Galileo Networking Cookbook

By : Marco Schwartz
Book Image

Intel Galileo Networking Cookbook

By: Marco Schwartz

Overview of this book

Table of Contents (15 chapters)
Intel Galileo Networking Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Running a simple Node.js server


In this recipe, we are going to use Intel XDK and Node.js to run a simple web server on the Galileo board. Node.js is a server-side framework written in JavaScript, which is widely used around the world for server applications. Luckily for us, the Galileo board is powerful enough to run Node.js applications, and this is what we will do in this recipe.

Getting ready

Before we can code our server, we need to create a new project or application in the Intel XDK software. This will allow us to write code inside XDK and upload it to the board. Since we will write all the code from scratch, we can create a blank project, as shown here:

How to do it...

We are now going to run a simple web server on the Galileo board. This simple server will always answer Hello World when we send a request to it. This is the complete code for this recipe:

// Required modules
var http = require('http');

// Configure our HTTP server to respond with Hello World to all requests.
var server...