Skip to content

Instantly share code, notes, and snippets.

View kiraind's full-sized avatar
🐽
strādāju

Alexei Paksevatkin kiraind

🐽
strādāju
  • Russia, Moscow
View GitHub Profile
@kiraind
kiraind / static_server.js
Last active August 20, 2018 10:41 — 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.
const http = require("http")
const url = require("url")
const path = require("path")
const fs = require("fs")
const port = process.argv[2] || 8888
http.createServer(function(request, response) {
const uri = url.parse(request.url).pathname
let filename = path.join(process.cwd(), 'static', uri)