diff --git a/back-end/src/app.ts b/back-end/src/app.ts index 5dd59ec..17c6482 100644 --- a/back-end/src/app.ts +++ b/back-end/src/app.ts @@ -3,11 +3,25 @@ import dotenv from 'dotenv'; dotenv.config() import express from 'express'; +import morgan from 'morgan'; +import path from 'path'; +import routes from './routes'; const app = express(); const port = process.env.PORT ?? 3000; +const log_format = (process.env.NODE_ENV === "dev") ? "dev": "combined"; +console.log("=== LOG CONFIG ==="); +console.log(`log format: ${log_format}`); +console.log("=== END LOG CONFIG ==="); + +// Need the path.join for node to resolve correctly the templates directory +app.set('views', path.join(__dirname, 'templates')); +app.set('view engine', 'ejs'); + +// Add logs +app.use(morgan(log_format)); app.listen(port, () => { - return console.log(`Express is listening at http://localhost:${port}`); + return console.log(`Briques is listening at http://localhost:${port}`); });