refactor(all): refactoring to remove monorepo taking to long to get it wokring as intended

This commit is contained in:
2025-02-19 10:06:43 -06:00
parent 5f7a3dd182
commit b15f1d8ae8
28 changed files with 736 additions and 112 deletions

View File

@@ -1,15 +1,16 @@
import {Hono} from "hono";
import {serveStatic} from "hono/bun";
import {logger} from "hono/logger";
import {ocmeService} from "./services/ocmeServer";
import {authMiddleware} from "lst-auth";
import {cors} from "hono/cors";
import {OpenAPIHono} from "@hono/zod-openapi";
//import { expensesRoute } from "./routes/expenses";
import login from "./route/auth/login";
import session from "./route/auth/session";
//routes
import auth from "./services/auth/authService";
import scalar from "./route/scalar";
// services
import {ocmeService} from "./services/ocme/ocmeServer";
const app = new Hono();
const app = new OpenAPIHono();
app.use("*", logger());
app.use(
@@ -24,24 +25,32 @@ app.use(
})
);
app.doc("/api", {
openapi: "3.0.0",
info: {
version: "1.0.0",
title: "LST API",
},
});
// as we dont want to change ocme again well use a proxy to this
app.all("/ocme/*", async (c) => {
return ocmeService(c);
});
app.basePath("/api/auth").route("/login", login).route("/session", session);
const routes = [scalar, auth] as const;
routes.forEach((route) => {
app.route("/", route);
});
//app.basePath("/api/auth").route("/login", login).route("/session", session).route("/register", register);
//auth stuff
app.get("/api/protected", authMiddleware, (c) => {
return c.json({success: true, message: "is authenticated"});
});
app.get("/api/test", (c) => {
return c.json({success: true, message: "hello from bun"});
});
// const authRoute = app.basePath("/api/auth").route("*", )
//const apiRoute = app.basePath("/api").route("/expenses", expensesRoute);
app.get("*", serveStatic({root: "../frontend/dist"}));
app.get("*", serveStatic({path: "../frontend/dist/index.html"}));