From a60569822bfe64312b9bcdcc44963c7881c6acba Mon Sep 17 00:00:00 2001 From: apetitco Date: Fri, 19 Dec 2025 15:05:46 +0100 Subject: [PATCH] fighting git conflicts --- src/tic-tac-toe/src/run.ts | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/tic-tac-toe/src/run.ts diff --git a/src/tic-tac-toe/src/run.ts b/src/tic-tac-toe/src/run.ts new file mode 100644 index 0000000..a65470a --- /dev/null +++ b/src/tic-tac-toe/src/run.ts @@ -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();