-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ts
29 lines (22 loc) · 790 Bytes
/
index.ts
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
import {ApplicationConfig, PrjApplication} from './application';
import {config} from './config';
export * from './application';
// not secured (specially for self-signed certificates)
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
//require('https').globalAgent.options.ca = require('ssl-root-cas/latest').create();
export async function main(options: ApplicationConfig = {}) {
const app = new PrjApplication(options);
await app.boot();
await app.start();
//await app.startWebSocket();
const url = app.restServer.url;
console.log(`Server is running at ${app.httpServer.url}/api`);
return app;
}
if (require.main === module) {
// Run the application
main(config).catch(err => {
console.error('Cannot start the application.', err);
process.exit(1);
});
}