From adf08806593fdcd3a3d9d0a6d07f0262501e21ad Mon Sep 17 00:00:00 2001 From: Blake Matthes Date: Tue, 25 Mar 2025 07:40:15 -0500 Subject: [PATCH] refactor(server): changed to log only when in dev, and removed the redirect of the url --- server/index.ts | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/server/index.ts b/server/index.ts index 87305ba..01d03e7 100644 --- a/server/index.ts +++ b/server/index.ts @@ -39,7 +39,10 @@ createLog("info", "LST", "server", `Server is installed: ${installed}`); const app = new OpenAPIHono({ strict: false }); // middle ware -app.use("*", logger()); +if (process.env.NODE_ENV === "development") { + app.use("*", logger()); +} + app.use( "*", cors({ @@ -53,17 +56,17 @@ app.use( ); // Middleware to normalize route case -app.use("*", async (c, next) => { - const lowercasedUrl = c.req.url.toLowerCase(); - //console.log("Incoming Request:", c.req.url, c.req.method); - // If the URL is already lowercase, continue as usual - if (c.req.url === lowercasedUrl) { - return next(); - } +// app.use("*", async (c, next) => { +// // const lowercasedUrl = c.req.url.toLowerCase(); +// console.log("Incoming Request:", c.req.url, c.req.method); +// // // If the URL is already lowercase, continue as usual +// // if (c.req.url === lowercasedUrl) { +// await next(); +// // } - // Otherwise, re-route internally - return c.redirect(lowercasedUrl, 308); // 308 preserves the HTTP method -}); +// // // Otherwise, re-route internally +// // return c.redirect(lowercasedUrl, 308); // 308 preserves the HTTP method +// }); app.doc("/api/ref", { openapi: "3.0.0",