Support custom port when running server

This commit is contained in:
David Evans 2018-04-29 20:32:40 +01:00
parent 78cec2be8c
commit 75aacf628f
1 changed files with 4 additions and 1 deletions

View File

@ -6,7 +6,10 @@ const {render} = require('./handlers/render');
const DEV = process.argv.includes('dev'); const DEV = process.argv.includes('dev');
const HOSTNAME = '127.0.0.1'; const HOSTNAME = '127.0.0.1';
const PORT = 8080; let PORT = Number.parseInt(process.argv[2], 10);
if(Number.isNaN(PORT)) {
PORT = 8080;
}
function devMapper(file, type, data) { function devMapper(file, type, data) {
if(!type.includes('text/html')) { if(!type.includes('text/html')) {