How to use the port function from optimist

Find comprehensive JavaScript optimist.port code examples handpicked from public code repositorys.

40
41
42
43
44
45
46
47
48
49
}

var http = require('http');
// set and check the validity of the HTTP listen port
// the environment variable $PORT is read for deployment on heroku
var httpport = process.env.PORT || argv.port;
if (isNaN(httpport) || httpport < 1) {
    console.log("missing or incorrect http listen port: '" + httpport + "' using default 8888\n");
    httpport = 8888;
}
fork icon112
star icon418
watch icon58