fighting git conflicts
This commit is contained in:
parent
1eae977147
commit
8898d53526
1 changed files with 36 additions and 0 deletions
36
src/tic-tac-toe/src/run.ts
Normal file
36
src/tic-tac-toe/src/run.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
// this sould only be used by the docker file !
|
||||||
|
|
||||||
|
import fastify, { FastifyInstance } from 'fastify';
|
||||||
|
import app from './app';
|
||||||
|
|
||||||
|
const start = async () => {
|
||||||
|
const envToLogger = {
|
||||||
|
development: {
|
||||||
|
transport: {
|
||||||
|
target: 'pino',
|
||||||
|
options: {
|
||||||
|
translateTime: 'HH:MM:ss Z',
|
||||||
|
ignore: 'pid,hostname',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
production: true,
|
||||||
|
test: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
const f: FastifyInstance = fastify({ logger: envToLogger.development });
|
||||||
|
try {
|
||||||
|
process.on('SIGTERM', () => {
|
||||||
|
f.log.info('Requested to shutdown');
|
||||||
|
process.exit(134);
|
||||||
|
});
|
||||||
|
console.log('-------->Serving static files from:');
|
||||||
|
await f.register(app, {});
|
||||||
|
await f.listen({ port: 80, host: '0.0.0.0' });
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
f.log.error(err);
|
||||||
|
process.exit(1);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
start();
|
||||||
Loading…
Add table
Add a link
Reference in a new issue