go-meow
Version:
A modular microservice template built with TypeScript, Express, and Prisma (MongoDB). It includes service scaffolding tools, consistent query utilities with data grouping, Zod validation, structured logging, comprehensive seeding system, and Swagger/OpenA
18 lines (17 loc) • 523 B
JavaScript
import { PrismaClient } from "../generated/prisma";
import { getLogger } from "../helper/logger";
const prisma = new PrismaClient();
const logger = getLogger();
export async function connectDb() {
try {
await prisma.$connect();
logger.info("Connected to the database successfully.");
}
catch (error) {
logger.error("Error connecting to the database:", {
error,
stack: error instanceof Error ? error.stack : undefined,
});
process.exit(1);
}
}