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

Using Express on Galileo


In the previous recipe, we saw how to build a minimal web server on the Galileo board, using the Node.js framework. However, it would be really hard to build more complex applications using this; the code would really get complicated.

To handle more complexity, we will use one of the most popular Node.js modules, Express, which also works on the Galileo board.

Getting ready

Express is a Node.js module that simplifies the process of creating and running web server applications on top of Node.js. You can find more information about Express on the official website at http://expressjs.com/.

You don't need to download or modify anything at this point, as Intel XDK will automatically install the Express module.

How to do it...

We will now see the code to run a simple web server using Express. This is the complete code for this recipe:

// Required modules
var express = require('express');
var app = express();

// Main route
app.get('/', function (req, res) {
  res.send('Hello...