Skip to content

Instantly share code, notes, and snippets.

View ngochoan1011's full-sized avatar
🎯
Focusing

Hoan Do ngochoan1011

🎯
Focusing
View GitHub Profile
@ngochoan1011
ngochoan1011 / static_server.js
Last active May 2, 2020 09:26 — 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 = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);