-
-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy path+server.ts
More file actions
50 lines (45 loc) · 1.69 KB
/
Copy path+server.ts
File metadata and controls
50 lines (45 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// (BATI.has("auth0") || BATI.hasDatabase) && !BATI.has("cloudflare")
import "dotenv/config";
import { authjsHandler, authjsSessionMiddleware } from "@batijs/authjs/server/authjs-handler";
import { dbMiddleware } from "@batijs/shared-db/server/db-middleware";
import { createTodoHandler } from "@batijs/shared-server/server/create-todo-handler";
import { telefuncHandler } from "@batijs/telefunc/server/telefunc-handler";
import { trpcHandler } from "@batijs/trpc/server/trpc-handler";
import { tsRestHandler } from "@batijs/ts-rest/server/ts-rest-handler";
import vike from "@vikejs/h3";
import { createApp, toWebHandler } from "h3";
import type { Server } from "vike/types";
const port = process.env.PORT ? parseInt(process.env.PORT, 10) : 3000;
function getHandler() {
const app = createApp();
vike(app, [
//# BATI.hasDbDemo
// Make database available in Context as `context.db`
dbMiddleware,
//# BATI.has("authjs") || BATI.has("auth0")
// Append Auth.js session to context
authjsSessionMiddleware,
//# BATI.has("authjs") || BATI.has("auth0")
// Auth.js route. See https://authjs.dev/getting-started/installation
authjsHandler,
//# BATI.has("trpc")
// tRPC route. See https://trpc.io/docs/server/adapters
trpcHandler("/api/trpc"),
//# BATI.has("telefunc")
// Telefunc route. See https://telefunc.com
telefuncHandler,
//# BATI.has("ts-rest")
// ts-rest route. See https://ts-rest.com
tsRestHandler,
//# !BATI.has("telefunc") && !BATI.has("trpc") && !BATI.has("ts-rest")
createTodoHandler,
]);
return toWebHandler(app);
}
// https://vike.dev/server
export default {
fetch: getHandler(),
prod: {
port,
},
} satisfies Server;