-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
42 lines (35 loc) · 1.56 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!node
// app.js
// create and start server from command line
//
/* eslint-disable @typescript-eslint/no-var-requires */
// const { createExpressionWithTypeArguments } = require('typescript');
import { HomeDingServer } from './dist-server/HomeDingServer.js';
import Logger from './dist-server/Logger.js';
import yargs from 'yargs';
console.log("HomeDing Portal Server");
const appOptions = yargs(process.argv.slice(2))
.usage('Usage: $0 -c <case name>')
.option('c', { alias: 'case', describe: 'Simulate case', type: 'string', demandOption: false, default: null })
.option('m', { alias: 'monitor', describe: 'monitor the requests', type: 'boolean', demandOption: false, default: false })
.option('p', { alias: 'port', describe: 'webserver port', type: 'number', demandOption: false, default: 3123 })
.option('s', { alias: 'secure', describe: 'Use https', type: 'boolean', demandOption: false, default: false })
.option('v', { alias: 'verbose', describe: 'Verbose logging', type: 'boolean', demandOption: false, default: false })
.argv;
Logger.enable('hd:error,hd:info');
if (appOptions.verbose) {
Logger.enable('*');
Logger.info('This processor architecture is ' + process.arch);
Logger.info('This platform is ' + process.platform);
Logger.info('cwd: ', process.cwd());
Logger.info('arguments: ', appOptions);
Logger.info('file', import.meta.url);
}
const s = new HomeDingServer();
// server.setPort(3123);
s.start({
case: appOptions.case,
monitor: appOptions.monitor,
port: 3123,
secure: appOptions.secure
});