Skip to content

Instantly share code, notes, and snippets.

View dmkc's full-sized avatar

Dmitry Kichenko dmkc

View GitHub Profile
@dmkc
dmkc / static_server.js
Created August 20, 2012 20:34 — forked from ryanflorence/static_server.js
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs"),
port = parseInt( process.argv[2] ) || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname,
filename = path.join(process.cwd(), uri);