forked from EvolutionAPI/evolution-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver-up.ts
More file actions
32 lines (28 loc) · 689 Bytes
/
server-up.ts
File metadata and controls
32 lines (28 loc) · 689 Bytes
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
import { configService, SslConf } from '@config/env.config';
import { Express } from 'express';
import { readFileSync } from 'fs';
import * as http from 'http';
import * as https from 'https';
export class ServerUP {
static #app: Express;
static set app(e: Express) {
this.#app = e;
}
static get https() {
try {
const { FULLCHAIN, PRIVKEY } = configService.get<SslConf>('SSL_CONF');
return https.createServer(
{
cert: readFileSync(FULLCHAIN),
key: readFileSync(PRIVKEY),
},
ServerUP.#app,
);
} catch {
return null
}
}
static get http() {
return http.createServer(ServerUP.#app);
}
}