From 97b3b9c747400a35a93de3372a16655280abf961 Mon Sep 17 00:00:00 2001 From: nicklassundin Date: Mon, 4 Nov 2024 14:24:34 +0100 Subject: [PATCH] fix(argument): argument for port --- modules/server/web.js | 7 ++++++- package.json | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/server/web.js b/modules/server/web.js index 8615f314e..ebba5e1f7 100644 --- a/modules/server/web.js +++ b/modules/server/web.js @@ -22,11 +22,16 @@ import https from "https"; * Webserver creation * @type {{http(*): ({ClientRequestArgs: ClientRequestArgs, ServerResponse: ServerResponse, Agent: Agent, STATUS_CODES: {[p: number]: string | undefined, [p: string]: string | undefined}, Server: Server, RequestOptions: RequestOptions, globalAgent: Agent, OutgoingHttpHeaders: OutgoingHttpHeaders, METHODS: string[], OutgoingMessage: OutgoingMessage, validateHeaderName(name: string): void, RequestListener: (req: InstanceType, res: (InstanceType & {req: InstanceType})) => void, setMaxIdleHTTPParsers(max: number): void, InformationEvent: InformationEvent, OutgoingHttpHeader: number | string | string[], createServer: {(requestListener?: RequestListener): Server, (options: ServerOptions, requestListener?: RequestListener): Server}, maxHeaderSize: number, ClientRequest: ClientRequest, IncomingMessage: IncomingMessage, AgentOptions: AgentOptions, validateHeaderValue(name: string, value: string): void, IncomingHttpHeaders: IncomingHttpHeaders, ServerOptions: ServerOptions, get: {(options: (RequestOptions | string | URL), callback?: (res: IncomingMessage) => void): ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest}, request: {(options: (RequestOptions | string | URL), callback?: (res: IncomingMessage) => void): ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest}} | {ClientRequestArgs: ClientRequestArgs, ServerResponse: ServerResponse, Agent: Agent, STATUS_CODES: {[p: number]: string | undefined, [p: string]: string | undefined}, Server: Server, RequestOptions: RequestOptions, globalAgent: Agent, OutgoingHttpHeaders: OutgoingHttpHeaders, METHODS: string[], OutgoingMessage: OutgoingMessage, validateHeaderName(name: string): void, RequestListener: (req: InstanceType, res: (InstanceType & {req: InstanceType})) => void, setMaxIdleHTTPParsers(count: number): void, InformationEvent: InformationEvent, OutgoingHttpHeader: number | string | string[], createServer: {(requestListener?: RequestListener): Server, (options: ServerOptions, requestListener?: RequestListener): Server}, maxHeaderSize: number, ClientRequest: ClientRequest, IncomingMessage: IncomingMessage, AgentOptions: AgentOptions, validateHeaderValue(name: string, value: string): void, IncomingHttpHeaders: IncomingHttpHeaders, ServerOptions: ServerOptions, get: {(options: (RequestOptions | string | URL), callback?: (res: IncomingMessage) => void): ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest}, request: {(options: (RequestOptions | string | URL), callback?: (res: IncomingMessage) => void): ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest}} | {ClientRequestArgs: ClientRequestArgs, ServerResponse: ServerResponse, Agent: Agent, STATUS_CODES: {[p: number]: string | undefined, [p: string]: string | undefined}, Server: Server, RequestOptions: RequestOptions, globalAgent: Agent, OutgoingHttpHeaders: OutgoingHttpHeaders, METHODS: string[], OutgoingMessage: OutgoingMessage, validateHeaderName(name: string): void, RequestListener: (req: InstanceType, res: (InstanceType & {req: InstanceType})) => void, setMaxIdleHTTPParsers(count: number): void, InformationEvent: InformationEvent, OutgoingHttpHeader: number | string | string[], createServer: {(requestListener?: RequestListener): Server, (options: ServerOptions, requestListener?: RequestListener): Server}, maxHeaderSize: number, ClientRequest: ClientRequest, IncomingMessage: IncomingMessage, AgentOptions: AgentOptions, validateHeaderValue(name: string, value: string): void, IncomingHttpHeaders: IncomingHttpHeaders, ServerOptions: ServerOptions, get: {(options: (RequestOptions | string | URL), callback?: (res: IncomingMessage) => void): ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest}, request: {(options: (RequestOptions | string | URL), callback?: (res: IncomingMessage) => void): ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest}} | {ClientRequestArgs: ClientRequestArgs, ServerResponse: ServerResponse, Agent: Agent, STATUS_CODES: {[p: number]: string | undefined, [p: string]: string | undefined}, Server: Server, RequestOptions: RequestOptions, globalAgent: Agent, OutgoingHttpHeaders: OutgoingHttpHeaders, METHODS: string[], OutgoingMessage: OutgoingMessage, validateHeaderName(name: string): void, RequestListener: (req: InstanceType, res: (InstanceType & {req: InstanceType})) => void, setMaxIdleHTTPParsers(count: number): void, InformationEvent: InformationEvent, OutgoingHttpHeader: number | string | string[], createServer: {(requestListener?: RequestListener): Server, (options: ServerOptions, requestListener?: RequestListener): Server}, maxHeaderSize: number, ClientRequest: ClientRequest, IncomingMessage: IncomingMessage, AgentOptions: AgentOptions, validateHeaderValue(name: string, value: string): void, IncomingHttpHeaders: IncomingHttpHeaders, ServerOptions: ServerOptions, get: {(options: (RequestOptions | string | URL), callback?: (res: IncomingMessage) => void): ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest}, request: {(options: (RequestOptions | string | URL), callback?: (res: IncomingMessage) => void): ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest}} | {ClientRequestArgs: ClientRequestArgs, ServerResponse: ServerResponse, Agent: Agent, STATUS_CODES: {[p: number]: string | undefined, [p: string]: string | undefined}, Server: Server, RequestOptions: RequestOptions, globalAgent: Agent, OutgoingHttpHeaders: OutgoingHttpHeaders, METHODS: string[], OutgoingMessage: OutgoingMessage, validateHeaderName(name: string): void, RequestListener: (req: InstanceType, res: (InstanceType & {req: InstanceType})) => void, setMaxIdleHTTPParsers(max: number): void, InformationEvent: InformationEvent, OutgoingHttpHeader: number | string | string[], createServer: {(requestListener?: RequestListener): Server, (options: ServerOptions, requestListener?: RequestListener): Server}, maxHeaderSize: number, ClientRequest: ClientRequest, IncomingMessage: IncomingMessage, AgentOptions: AgentOptions, validateHeaderValue(name: string, value: string): void, IncomingHttpHeaders: IncomingHttpHeaders, ServerOptions: ServerOptions, get: {(options: (RequestOptions | string | URL), callback?: (res: IncomingMessage) => void): ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest}, request: {(options: (RequestOptions | string | URL), callback?: (res: IncomingMessage) => void): ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest}} | {ClientRequestArgs: ClientRequestArgs, ServerResponse: ServerResponse, Agent: Agent, STATUS_CODES: {[p: number]: string | undefined, [p: string]: string | undefined}, Server: Server, RequestOptions: RequestOptions, globalAgent: Agent, OutgoingHttpHeaders: OutgoingHttpHeaders, METHODS: string[], OutgoingMessage: OutgoingMessage, validateHeaderName(name: string): void, RequestListener: (req: InstanceType, res: (InstanceType & {req: InstanceType})) => void, setMaxIdleHTTPParsers(count: number): void, InformationEvent: InformationEvent, OutgoingHttpHeader: number | string | string[], createServer: {(requestListener?: RequestListener): Server, (options: ServerOptions, requestListener?: RequestListener): Server}, maxHeaderSize: number, ClientRequest: ClientRequest, IncomingMessage: IncomingMessage, AgentOptions: AgentOptions, validateHeaderValue(name: string, value: string): void, IncomingHttpHeaders: IncomingHttpHeaders, ServerOptions: ServerOptions, get: {(options: (RequestOptions | string | URL), callback?: (res: IncomingMessage) => void): ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest}, request: {(options: (RequestOptions | string | URL), callback?: (res: IncomingMessage) => void): ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest}}|undefined), https(*): ({get: {(options: (RequestOptions | string | URL), callback?: (res: http.IncomingMessage) => void): http.ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest}, request: {(options: (RequestOptions | string | URL), callback?: (res: http.IncomingMessage) => void): http.ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest}, Agent: Agent, Server: Server, createServer: {(requestListener?: http.RequestListener): Server, (options: ServerOptions, requestListener?: http.RequestListener): Server}, RequestOptions: http.RequestOptions & tls.SecureContextOptions & {checkServerIdentity?: typeof tls.checkServerIdentity | undefined, rejectUnauthorized?: boolean | undefined, servername?: string | undefined}, globalAgent: Agent, AgentOptions: AgentOptions, ServerOptions: tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions} | {get: {(options: (RequestOptions | string | URL), callback?: (res: http.IncomingMessage) => void): http.ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest}, request: {(options: (RequestOptions | string | URL), callback?: (res: http.IncomingMessage) => void): http.ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest}, Agent: Agent, Server: Server, createServer: {(requestListener?: http.RequestListener): Server, (options: ServerOptions, requestListener?: http.RequestListener): Server}, RequestOptions: http.RequestOptions & tls.SecureContextOptions & {checkServerIdentity?: typeof tls.checkServerIdentity | undefined, rejectUnauthorized?: boolean | undefined, servername?: string | undefined}, globalAgent: Agent, AgentOptions: AgentOptions, ServerOptions: tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions} | {get: {(options: (RequestOptions | string | URL), callback?: (res: http.IncomingMessage) => void): http.ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest}, request: {(options: (RequestOptions | string | URL), callback?: (res: http.IncomingMessage) => void): http.ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest}, Agent: Agent, Server: Server, createServer: {(requestListener?: http.RequestListener): Server, (options: ServerOptions, requestListener?: http.RequestListener): Server}, RequestOptions: http.RequestOptions & tls.SecureContextOptions & {checkServerIdentity?: typeof tls.checkServerIdentity | undefined, rejectUnauthorized?: boolean | undefined, servername?: string | undefined}, globalAgent: Agent, AgentOptions: AgentOptions, ServerOptions: tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions} | {get: {(options: (RequestOptions | string | URL), callback?: (res: http.IncomingMessage) => void): http.ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest}, request: {(options: (RequestOptions | string | URL), callback?: (res: http.IncomingMessage) => void): http.ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest}, Agent: Agent, Server: Server, createServer: {(requestListener?: http.RequestListener): Server, (options: ServerOptions, requestListener?: http.RequestListener): Server}, RequestOptions: http.RequestOptions & tls.SecureContextOptions & {checkServerIdentity?: typeof tls.checkServerIdentity | undefined, rejectUnauthorized?: boolean | undefined, servername?: string | undefined}, globalAgent: Agent, AgentOptions: AgentOptions, ServerOptions: tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions} | {get: {(options: (RequestOptions | string | URL), callback?: (res: http.IncomingMessage) => void): http.ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest}, request: {(options: (RequestOptions | string | URL), callback?: (res: http.IncomingMessage) => void): http.ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest}, Agent: Agent, Server: Server, createServer: {(requestListener?: http.RequestListener): Server, (options: ServerOptions, requestListener?: http.RequestListener): Server}, RequestOptions: http.RequestOptions & tls.SecureContextOptions & {checkServerIdentity?: typeof tls.checkServerIdentity | undefined, rejectUnauthorized?: boolean | undefined, servername?: string | undefined}, globalAgent: Agent, AgentOptions: AgentOptions, ServerOptions: tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions} | {get: {(options: (RequestOptions | string | URL), callback?: (res: http.IncomingMessage) => void): http.ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest}, request: {(options: (RequestOptions | string | URL), callback?: (res: http.IncomingMessage) => void): http.ClientRequest, (url: (string | URL), options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest}, Agent: Agent, Server: Server, createServer: {(requestListener?: http.RequestListener): Server, (options: ServerOptions, requestListener?: http.RequestListener): Server}, RequestOptions: http.RequestOptions & tls.SecureContextOptions & {checkServerIdentity?: typeof tls.checkServerIdentity | undefined, rejectUnauthorized?: boolean | undefined, servername?: string | undefined}, globalAgent: Agent, AgentOptions: AgentOptions, ServerOptions: tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions}|undefined)}} */ +import minimist from "minimist"; export default { http: function (app) { const config = loadConfig(); + let port = config.port + const args = minimist(process.argv.slice(2)) + if(args.port) + port = args.port try { - http.createServer(app).listen(config.port); + http.createServer(app).listen(port); return http } catch (err) { diff --git a/package.json b/package.json index 91312bf9c..b7fd26a5e 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "start-full": "npm run update && git submodule update && npm test && npx nodemon run.js", "dev": "clear; npm run update && npx nodemon -x NODE_ENV=development node run.js", "dev-no-update": "clear; npx nodemon -x NODE_ENV=development node run.js", + "start-aws": "node run.js --port=3000", "dev-inspect": "clear; npx nodemon -x node --inspect NODE_ENV=develoment run.js", "static": "cp client/bundle.js static/bundle.js", "webpack": "webpack --mode=development",