beginning refactor for production server hosting

This commit is contained in:
Josh Burman 2019-03-31 03:17:50 -04:00
parent 075bb2579c
commit 2ff0b7fa9f

View File

@ -16,25 +16,25 @@ import ClientBase from './clients/clientBase';
import MHSClient from './clients/sites/mhsClient';
if (app.environment == 'development') {
var privateKey = fs.readFileSync(app.privateKey, 'utf8');
var certificate = fs.readFileSync(app.certificate, 'utf8');
var options = {key: privateKey, cert: certificate, hostname: app.hostname};
// if (app.environment == 'development') {
// var privateKey = fs.readFileSync(app.privateKey, 'utf8');
// var certificate = fs.readFileSync(app.certificate, 'utf8');
// var options = {key: privateKey, cert: certificate, hostname: app.hostname};
const application = express();
const server = https.createServer(options, application);
var wss = new WebSocket.Server({ server: server, maxPayload:250000, host: app.hostname });
// const application = express();
// const server = https.createServer(options, application);
// var wss = new WebSocket.Server({ server: server, maxPayload:250000, host: app.hostname });
application.use(express.json());
application.use('', routes);
// application.use(express.json());
// application.use('', routes);
server.listen(app.port, () => {
console.log(`Braid v${app.version} is running!\n`);
logger.accessLog.info(`Braid v${app.version} is running!\n`);
});
} else {
var wss = new WebSocket.Server({ noServer: true, maxPayload:250000, host: app.hostname });
}
// server.listen(app.port, () => {
// console.log(`Braid v${app.version} is running!\n`);
// logger.accessLog.info(`Braid v${app.version} is running!\n`);
// });
// } else {
var wss = new WebSocket.Server({ maxPayload:250000, port: app.port });
// }
let clientManager = new ClientManager();
let channelManager = new ChannelManager();