Remove console logging from app.js

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-09-26 20:36:04 +01:00
parent 491052b1ae
commit 12876f8964

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