Last active
December 4, 2016 23:42
-
-
Save seb-patron/8b7034c3a16245ab7b64c9df62bd52e0 to your computer and use it in GitHub Desktop.
Serves a static file from a server. Requires the node-static module. Used in my Selfie App tutorial.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var static = require('node-static'); | |
// https://www.npmjs.com/package/node-static | |
// Create a node-static server instance to serve the './public' folder | |
// | |
var file = new static.Server('./public'); | |
require('http').createServer(function (request, response) { | |
request.addListener('end', function () { | |
file.serve(request, response); | |
}).resume(); | |
}).listen(8080); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment