mirror of
https://github.com/FranP-code/Reflecto.git
synced 2025-10-13 00:43:31 +00:00
Add logger utility and integrate Docker Compose startup in development
This commit is contained in:
@@ -5,11 +5,28 @@ import { appRouter } from "./routers/index";
|
||||
import { auth } from "./lib/auth";
|
||||
import { Hono } from "hono";
|
||||
import { cors } from "hono/cors";
|
||||
import { logger } from "hono/logger";
|
||||
import { logger as honoLogger } from "hono/logger";
|
||||
|
||||
import { join } from "node:path";
|
||||
import { execSync } from "node:child_process";
|
||||
import { logger } from "./lib/logger";
|
||||
|
||||
const app = new Hono();
|
||||
|
||||
app.use(logger());
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
try {
|
||||
const composePath = join(process.cwd(), "docker-compose.yml");
|
||||
execSync(`docker-compose -f ${composePath} up -d`, { stdio: "inherit" });
|
||||
logger.info("Waiting for services to start...");
|
||||
execSync("sleep 2");
|
||||
logger.info("Docker Compose started successfully");
|
||||
} catch (error) {
|
||||
logger.error("Failed to start Docker Compose:", error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
app.use(honoLogger());
|
||||
app.use(
|
||||
"/*",
|
||||
cors({
|
||||
|
||||
Reference in New Issue
Block a user