Skip to content

Instantly share code, notes, and snippets.

@not-only-code
Last active August 29, 2015 14:07
Show Gist options
  • Save not-only-code/17a4aed49b6edefd3a0f to your computer and use it in GitHub Desktop.
Save not-only-code/17a4aed49b6edefd3a0f to your computer and use it in GitHub Desktop.
Create static server easily
var static = require('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 () {
//
// Serve files!
//
file.serve(request, response);
}).resume();}).listen(1331);
console.log('server started at: http://localhost:1331');
console.log('press ctrl + c to stop server');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment