require('dotenv').config(); const express = require('express'); // Invoke express app const app = express(); const APIRoutes = require('./routes/api'); // Middleware to log requests app.use((req, res, next) => { let time = new Date().toLocaleTimeString(); console.log(time + ' | Request received | path: ' + req.path + ' | method: ' + req.method); next(); }); app.use(APIRoutes); // Listen on port set in .env app.listen(process.env.PORT, () => { console.log('Server is listening on port ' + process.env.PORT); });