newStaffLDB-API #48

Merged
fred.boniface merged 85 commits from newStaffLDB-API into main 2023-10-03 21:35:03 +01:00
Showing only changes of commit 12876f8964 - Show all commits

5
app.js
View File

@ -2,12 +2,10 @@
// Please see the included LICENSE file
console.log("Initialising OwlBoard");
const mode = process.env.NODE_ENV || "development";
// Logging
const logger = require("./src/utils/logger.utils");
const pino = require("pino-http");
logger.logger.info("Logger Initialised");
// External Requires
@ -60,7 +58,7 @@ app.disable('x-powered-by');
// Express Error Handling:
app.use((err, req, res, next) => {
const statusCode = err.statuscode || 500;
console.error(err.message, err.stack);
logger.logger.error(err, "Express Error")
res.status(statusCode).json({ message: err.message });
return;
});
@ -75,7 +73,6 @@ app.use(express.json()); //JSON Parsing for POST Requests
app.use(compression()); // Compress API Data if supported by client
app.use(limiter);
app.use(authenticate);
app.use(pino);
// 2023 Rationalisation Routes (/api/v2, /misc)
app.use("/api/v2/pis", pis2Rtr); // API Version 2