Skip to content

Instantly share code, notes, and snippets.

View joaoffcosta's full-sized avatar

João Costa joaoffcosta

View GitHub Profile
@joaoffcosta
joaoffcosta / static_server.js
Last active December 21, 2015 18:29 — forked from ryanflorence/static_server.js
Adds logs, reviews code alignment and fixes path.exists
var http = require("http");
var url = require("url");
var path = require("path");
var fs = require("fs");
var port = process.argv[2] || 8000;
http.createServer(function(request, response) {
console.log(request["method"] + " " + request["url"]);
var uri = url.parse(request.url).pathname;