Skip to content

Commit

Permalink
feat(port): port argument used
Browse files Browse the repository at this point in the history
Port argument (--port) can be used to set port for the http socket of the ViWi server
  • Loading branch information
Luennemann authored Mar 10, 2017
1 parent 7b6b9b7 commit 5b418c1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import { viwiLogger } from "./log";
*/
const commandLineArgs = require('command-line-args')
const optionDefinitions = [
{ name: 'verbosity', alias: 'v', type: String }
{ name: 'verbosity', alias: 'v', type: String },
{ name: 'port', alias: 'p', type: Number }
]
const cla = commandLineArgs(optionDefinitions);
/** end parse command line argunments */
Expand All @@ -36,7 +37,7 @@ var server:WebServer;

var run = (port?:number):Promise<void> => {
return new Promise<void>((resolve, reject) => {
server = new WebServer(port);
server = new WebServer(cla.port);
server.init(); // need to init

server.app.get(BASEURI, (req: express.Request, res: express.Response, next: express.NextFunction) => {
Expand Down Expand Up @@ -458,4 +459,4 @@ function filterByKeys(inputObject:any, keep:string[]):Object {
return result;
};

export {server, run, pathof}
export {server, run, pathof}

0 comments on commit 5b418c1

Please sign in to comment.