Skip to content

Instantly share code, notes, and snippets.

@boxxa
Created July 9, 2015 03:32
Show Gist options
  • Save boxxa/420bfe39fc9cc7aa8637 to your computer and use it in GitHub Desktop.
Save boxxa/420bfe39fc9cc7aa8637 to your computer and use it in GitHub Desktop.
Quick NodeJS Static Server
// Quick way to serve files in a web server for testing
// npm install connect serve-static
// node run.js folder
var dirPath = process.argv[2];
console.log("Serving: " + dirPath);
var connect = require('connect');
var serveStatic = require('serve-static');
connect().use(serveStatic(dirPath)).listen(8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment