Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
staticserver.js
var express = require("express"),
open = require('open'),
app = express(),
port = ENTERPORT,
host = 'ENTER HOST IP';
if(process.argv.length > 2) {
port = parseInt(process.argv[2]);
}
app.use(express.static(__dirname));
app.listen(port, host);
open('http://' + host + ':' + port, function(err) {if(err) throw err;});
console.log('Listens on ' + host + ':' + port + '...');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment