newStaffLDB-API #48
5
app.js
5
app.js
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user