Skip to content

Instantly share code, notes, and snippets.

@nazgob
Created April 24, 2011 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nazgob/939853 to your computer and use it in GitHub Desktop.
Save nazgob/939853 to your computer and use it in GitHub Desktop.
node.js static content server
require.paths.unshift(__dirname + "/vendor");
var http = require('http'),
sys = require('sys'),
nodeStatic = require('node-static/lib/node-static');
var server = http.createServer(function(request, response) {
var file = new nodeStatic.Server('./public', {
cache: false
});
request.addListener('end', function() {
file.serve(request, response);
});
});
server.listen(8000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment