api: clean up prisma client injection awkwardness
Parents:
6a9fe5b1 file(s) changed
- api/src/createApp.ts +1 -7
api/src/createApp.ts
@@ -7,7 +7,7 @@ import authRouter from '@app/routes/auth';
7 7 import { errorHandler } from '@app/middleware/errorHandler';
8 8 import { PrismaClient } from '@prisma/client';
9 9
10 - export function createApp(prismaClient?: PrismaClient) {
10 + export function createApp() {
11 11 const app = express();
12 12
13 13 // Configure CORS
@@ -16,17 +16,11 @@ origin: process.env.FRONTEND_URL || '*',
16 16 credentials: true
17 17 }));
18 18
19 - app.use(express.json());
20 19 app.use(bodyParser.json());
21 20
22 21 // Only use morgan in non-test environments
23 22 if (process.env.NODE_ENV !== 'test') {
24 23 app.use(morgan('combined'));
25 - }
26 -
27 - // Make prisma client available to routes if provided (for testing)
28 - if (prismaClient) {
29 - app.locals.prisma = prismaClient;
30 24 }
31 25
32 26 app.use("/users", userRouter);