Initial commit
This commit is contained in:
commit
e6d6427ddc
29 changed files with 4378 additions and 0 deletions
35
api/src/main.ts
Normal file
35
api/src/main.ts
Normal 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();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue