fix: production crash due to undefined import.meta.env by adding env utility and updating build script
This commit is contained in:
13
src/index.ts
13
src/index.ts
@@ -15,10 +15,8 @@ const api = new Elysia({
|
||||
prefix: "/api",
|
||||
})
|
||||
.all("/auth/*", ({ request }) => auth.handler(request))
|
||||
.use(cors());
|
||||
|
||||
if (!isProduction) {
|
||||
api.use(
|
||||
.use(cors())
|
||||
.use(
|
||||
swagger({
|
||||
path: "/docs",
|
||||
documentation: {
|
||||
@@ -28,10 +26,7 @@ if (!isProduction) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
api
|
||||
)
|
||||
.get("/session", async ({ request }) => {
|
||||
const data = await auth.api.getSession({ headers: request.headers });
|
||||
return { data };
|
||||
@@ -191,4 +186,4 @@ console.log(
|
||||
`🚀 Server running at http://localhost:3000 in ${isProduction ? "production" : "development"} mode`,
|
||||
);
|
||||
|
||||
export type ApiApp = typeof app;
|
||||
export type ApiApp = typeof app;
|
||||
Reference in New Issue
Block a user