Skip to content

Instantly share code, notes, and snippets.

@houhr
Created February 8, 2015 06:36
Show Gist options
  • Save houhr/aec37d5e8b948baeaad9 to your computer and use it in GitHub Desktop.
Save houhr/aec37d5e8b948baeaad9 to your computer and use it in GitHub Desktop.
var servi = require('servi');
var app = new servi(false); // servi instance
function sendData(request) {
// print out the fact that a client HTTP request came in to the server:
console.log("Got a client request, sending them the data.");
// respond to the client request with the latest serial string:
request.respond(latestData);
}
app.port(8080); // port number to run the server on
app.serveFiles("public"); // serve static HTML from public folder
app.route('/data', sendData); // route requests for /data to sendData()
app.start(); // start the server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment