2023-06-23 13:08:16 +02:00
|
|
|
require('dotenv').config();
|
|
|
|
const { APP_DEBUG } = process.env;
|
|
|
|
|
|
|
|
const fastify = require('fastify')({ logger: APP_DEBUG == 'true' });
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
fastify.register(require('@fastify/static'), {
|
|
|
|
root: path.join(__dirname, 'public'),
|
|
|
|
prefix: '/'
|
|
|
|
});
|
|
|
|
|
2023-06-23 15:11:59 +02:00
|
|
|
// load routes from routes.js
|
|
|
|
require('./routes')(fastify);
|
|
|
|
console.log('Starting up')
|
|
|
|
|
2023-06-23 13:08:16 +02:00
|
|
|
fastify.listen({ port: process.env.APP_PORT ?? 8000 }, (err, address) => {
|
|
|
|
if (err) throw err;
|
|
|
|
console.log(`Listening on ${address}`);
|
|
|
|
})
|