diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2020-05-16 00:01:06 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2020-05-16 00:01:06 -0400 |
commit | a0dc46dc565418fef9a257508a92c788c4ec50af (patch) | |
tree | f0b534e40e9132f42b7941c4076b0506fb126852 /src/server/server_Initialization.ts | |
parent | 08b6bf8b51ab631c8cfe9c3e12bfb0ae2dd7b4c7 (diff) |
fixed some issues with frame animation. added comic rendering mode. added server certficate keys to get SSL to work?
Diffstat (limited to 'src/server/server_Initialization.ts')
-rw-r--r-- | src/server/server_Initialization.ts | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/server/server_Initialization.ts b/src/server/server_Initialization.ts index 14b0dedc3..6866b01e3 100644 --- a/src/server/server_Initialization.ts +++ b/src/server/server_Initialization.ts @@ -22,6 +22,7 @@ import { publicDirectory } from '.'; import { logPort, } from './ActionUtilities'; import { blue, yellow } from 'colors'; import * as cors from "cors"; +var https = require('https'); /* RouteSetter is a wrapper around the server that prevents the server from being exposed. */ @@ -49,27 +50,25 @@ export default async function InitializeServer(routeSetter: RouteSetter) { registerRelativePath(app); const serverPort = isRelease ? Number(process.env.serverPort) : 1050; - const server = app.listen(serverPort, () => { - logPort("server", serverPort); - console.log(); - }); - // var express = require('express') - // var fs = require('fs') - // var https = require('https') - // var app = express() - - // app.get('/', function (req, res) { - // res.send('hello world') - // }) - - // https.createServer({ - // key: fs.readFileSync('server.key'), - // cert: fs.readFileSync('server.cert') - // }, app) - // .listen(3000, function () { - // console.log('Example app listening on port 3000! Go to https://localhost:3000/') - // }) + let server: any; + if (isRelease) { + server = https.createServer({ + key: fs.readFileSync(`./${process.env.serverName}.key`), + cert: fs.readFileSync(`./${process.env.serverName}.cert`) + }, app); + server.listen(serverPort, function () { + logPort("server", serverPort); + console.log(); + // console.log('Example app listening on port 3000! Go to https://localhost:3000/') + }); + } else { + server = app.listen(serverPort, () => { + logPort("server", serverPort); + console.log(); + }); + } + disconnect = async () => new Promise<Error>(resolve => server.close(resolve)); return isRelease; |