Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

Commit

Permalink
fix(port): allow custom port numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
nahtnam committed May 19, 2019
1 parent 1a8d6ed commit 664f2bd
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/cli/commands/dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export const builder: CommandBuilder = {
boolean: true,
default: true,
},
port: {
alias: 'p',
description: 'specify which port the server should run on',
},
dir: {
default: './',
description: 'base directory for the light server',
Expand All @@ -30,6 +34,7 @@ export const builder: CommandBuilder = {
interface Args {
log: boolean;
dir: string;
port?: string;
}

const handle = async (argv: Args): Promise<void> => {
Expand All @@ -48,12 +53,18 @@ const handle = async (argv: Args): Promise<void> => {
}

const {
PORT = 3000,
HOST = '0.0.0.0',
}: ProcessEnv = process.env;

let {
PORT = 3000,
}: ProcessEnv = process.env;
if (argv.port) {
PORT = argv.port;
}

app.server.listen(PORT, (HOST as any), (): void => {
logger.listening('on port 3000');
logger.listening(`on port ${PORT}`);

logger.hmr('starting the hot reloader');
const chokidar = require('chokidar'); // eslint-disable-line
Expand Down

0 comments on commit 664f2bd

Please sign in to comment.