Spaces:
Runtime error
Runtime error
Download src/utils/server-up.ts from oex2003/evolution-api: direct link, hf CLI and curl.
- Browser
- Download file 625 Bytes
-
https://huggingface.co/spaces/oex2003/evolution-api/resolve/refs%2Fpr%2F1/src/utils/server-up.ts
- Command line
-
hf download hf://spaces/oex2003/evolution-api@refs/pr/1/src/utils/server-up.ts
-
curl -L -o server-up.ts https://huggingface.co/spaces/oex2003/evolution-api/resolve/refs%2Fpr%2F1/src/utils/server-up.ts
625 Bytes
| 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() { | |
| 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); | |
| } | |
| } | |