From 77570ce58b28fe014c7677c1970f7f2691539c6e Mon Sep 17 00:00:00 2001 From: Andrew Dodson Date: Mon, 12 Apr 2021 22:51:57 +0100 Subject: [PATCH] fix: directory definition --- bin/localhost | 0 server.js | 5 +++-- 2 files changed, 3 insertions(+), 2 deletions(-) mode change 100644 => 100755 bin/localhost diff --git a/bin/localhost b/bin/localhost old mode 100644 new mode 100755 diff --git a/server.js b/server.js index de1145a..8a71a2f 100644 --- a/server.js +++ b/server.js @@ -1,9 +1,10 @@ /* eslint-disable no-console */ const localhost = require('./index.js'); const portfinder = require('portfinder'); -const argv = require('minimist')(process.argv); +const argv = require('minimist')(process.argv.slice(2)); const port = argv.p || parseInt(process.env.PORT); +const dir = argv._.pop() || './'; if (!port) { portfinder.basePort = 8080; @@ -19,7 +20,7 @@ else { } function listen(port) { - localhost(argv._[0] || './').listen(port); + localhost(dir).listen(port); console.log(`Starting //localhost${port !== 80 ? `:${port}` : ''}`); }