init project evolution api

This commit is contained in:
Davidson Gomes
2023-06-09 07:48:59 -03:00
commit 2a1c426311
90 changed files with 9820 additions and 0 deletions

28
src/utils/server-up.ts Normal file
View File

@@ -0,0 +1,28 @@
import { Express } from 'express';
import { readFileSync } from 'fs';
import { configService, SslConf } from '../config/env.config';
import * as https from 'https';
import * as http from 'http';
export class ServerUP {
static #app: Express;
static set app(e: Express) {
this.#app = e;
}
static get https() {
const { FULLCHAIN, PRIVKEY } = configService.get<SslConf>('SSL_CONF');
return https.createServer(
{
cert: readFileSync(FULLCHAIN),
key: readFileSync(PRIVKEY),
},
ServerUP.#app,
);
}
static get http() {
return http.createServer(ServerUP.#app);
}
}