Created
January 28, 2015 21:00
-
-
Save kimgunnarsson/01830d83292240d697b2 to your computer and use it in GitHub Desktop.
staticserver.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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