Initial commit

This commit is contained in:
Oliver 2023-08-29 19:10:54 -06:00 committed by GitHub
commit e6d6427ddc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 4378 additions and 0 deletions

35
api/src/main.ts Normal file
View file

@ -0,0 +1,35 @@
// Filepath aliasing to avoid relative-imports whenever possible, this must stay
// at the top of this file as the first statement
import "module-alias/register";
import { Logger } from "tslog";
import { start } from "~/hapi";
export const isDev = process.env.NODE_ENV?.startsWith(`dev`);
let logLevel = 4;
if (process.env.LOG_LEVEL) {
logLevel = parseInt(process.env.LOG_LEVEL);
} else if (isDev) {
logLevel = 0;
};
export const log = new Logger({
minLevel: logLevel,
hideLogPositionForProduction: !isDev,
maskValuesOfKeys: [ `password`, `token` ],
});
async function main() {
let server = await start();
log.info(`Server listening`)
};
if (require.main === module) {
process.on(`unhandledRejection`, err => {
log.error(err);
process.exit(1);
});
main();
};