Mom-Portal/backend/src/routes/index.js
KevinB-T 30894e7f27 Configure VM services and fix auth flow
- point MySQL and Whisper settings to the VM
- add VM MySQL bootstrap scripts and docs
- allow LAN Vite origins for CORS
- fix Express 5 validation assignment crash
- allow login with username or email
- prevent recursive auth refresh retries
2026-05-15 15:19:49 +05:30

33 lines
892 B
JavaScript

import { Router } from "express";
import { pingDatabase } from "../config/database.js";
import { env } from "../config/env.js";
import { checkWhisperHealth } from "../services/transcriptionService.js";
import { sendSuccess } from "../utils/apiResponse.js";
import { asyncHandler } from "../utils/asyncHandler.js";
import { v1Routes } from "./v1/index.js";
export const routes = Router();
routes.get(
"/health",
asyncHandler(async (_req, res) => {
const [database, whisper] = await Promise.all([
pingDatabase()
.then(() => ({ healthy: true }))
.catch((error) => ({
healthy: false,
error: error.message,
})),
checkWhisperHealth(),
]);
sendSuccess(res, "Orphion API is healthy", {
service: "orphion-api",
env: env.nodeEnv,
database,
whisper,
});
}),
);
routes.use(env.apiPrefix, v1Routes);