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

Creating a file-sharing server


In this first recipe, we are going to see how to create a very basic file-sharing server that can be hosted by the Galileo board. This can later be used as a file-sharing server for your home, or just to include file-sharing capabilities in your applications.

Getting ready

For this recipe and for the whole chapter, you will need to have your Galileo board running the Intel IoT image, and be connected to the Web via the Ethernet port or the Wi-Fi extension board.

You will also need to have the Intel XDK software installed on your computer.

How to do it...

The file-sharing server will be really basic here; we will just serve a single file (a video is given as an example). We will again use the Express Node.js framework for this recipe.

This is the complete code for this recipe:

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

// Main route
app.get('/', function (req, res) {
  res.send('Welcome to your fileserver!');
});

// Download route...