Create a super primitive websocket server

This commit is contained in:
Oliver-Akins 2022-01-04 20:30:11 -07:00
parent 7e5a4ffe86
commit cb09d4a9df
5 changed files with 90 additions and 0 deletions

26
server/src/main.ts Normal file
View file

@ -0,0 +1,26 @@
import startWebsocketServer from "./websocket";
import { Logger } from "tslog";
import toml from "toml";
import fs from "fs";
// load the config
try {
var configData = toml.parse(fs.readFileSync("config.toml", "utf-8"));
} catch {
console.error("Can't find config file. Exiting");
process.exit(1);
};
export const config: IConfig = configData;
// Define the logger
export const log = new Logger({
displayFilePath: "hidden",
displayFunctionName: false,
displayDateTime: true,
displayLoggerName: false,
displayLogLevel: true,
minLevel: config.log.level,
});
startWebsocketServer();