feat(apihits): added in api hits to monitor and assist for issues

This commit is contained in:
2025-09-25 12:26:58 -05:00
parent 458232d337
commit 202f5af3ed
3 changed files with 69 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ import cors from "cors";
import { sendNotify } from "./src/pkg/utils/notify.js";
import { toNodeHandler } from "better-auth/node";
import { auth } from "./src/pkg/auth/auth.js";
import { apiHitMiddleware } from "./src/pkg/middleware/apiHits.js";
const main = async () => {
const env = validateEnv(process.env);
@@ -74,6 +75,8 @@ const main = async () => {
}
// global middleware
app.set("trust proxy", true);
app.use(apiHitMiddleware);
app.all(basePath + "/api/auth/*splat", toNodeHandler(auth)); // sign-in sign-out
app.use(express.json());
@@ -81,6 +84,7 @@ const main = async () => {
"http://localhost:5173", // lstV2 dev
"http://localhost:5500", // lst dev
"http://localhost:4200", // express
"http://localhost:4000", // prod port
env.BETTER_AUTH_URL, // prod
];