mirror of
https://github.com/sasjs/server.git
synced 2025-12-10 19:34:34 +00:00
22 lines
603 B
TypeScript
22 lines
603 B
TypeScript
import path from 'path'
|
|
import { readFileSync } from 'fs'
|
|
import * as https from 'https'
|
|
import appPromise from './app'
|
|
|
|
const keyPath = path.join('..', 'certificates', 'privkey.pem')
|
|
const certPath = path.join('..', 'certificates', 'fullchain.pem')
|
|
|
|
const key = readFileSync(keyPath)
|
|
const cert = readFileSync(certPath)
|
|
|
|
appPromise.then((app) => {
|
|
const httpsServer = https.createServer({ key, cert }, app)
|
|
|
|
const sasJsPort = process.env.PORT ?? 5000
|
|
httpsServer.listen(sasJsPort, () => {
|
|
console.log(
|
|
`⚡️[server]: Server is running at https://localhost:${sasJsPort}`
|
|
)
|
|
})
|
|
})
|