(misc): Started working on entrypoint for the microservice.
This commit is contained in:
parent
e9a61f1716
commit
c7149cffad
1 changed files with 30 additions and 0 deletions
30
src/tic-tac-toe/src/run.ts
Normal file
30
src/tic-tac-toe/src/run.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// @file run.ts
|
||||
|
||||
// Entry point of the microservice, ran by the Dockerfile.
|
||||
|
||||
import fastify, { FastifyInstance } from 'fastify';
|
||||
// TODO: Import the microservice app
|
||||
|
||||
|
||||
// @brief Entrypoint for the microservice's backend.
|
||||
const start = async () => {
|
||||
// TODO: Thingies to send to log service (if I understood that correctly from /src/chat/src/run.ts)
|
||||
|
||||
// TODO: Add the logging thingy to the call to fastify()
|
||||
const fastInst: FastifyInstance = fastify();
|
||||
try {
|
||||
process.on('SIGTERM', () => {
|
||||
fastInst.log.info('Requested to shutdown');
|
||||
process.exit(143);
|
||||
});
|
||||
// TODO: Uncomment when app.ts will be import-able.
|
||||
// await fastInst.register(app);
|
||||
await fastInst.listen({ port: 80, host: '0.0.0.0' });
|
||||
}
|
||||
catch (err) {
|
||||
fastInst.log.error(err);
|
||||
process.exit(1);
|
||||
};
|
||||
};
|
||||
|
||||
start();
|
||||
Loading…
Add table
Add a link
Reference in a new issue