-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.ts
More file actions
45 lines (39 loc) · 1.17 KB
/
server.ts
File metadata and controls
45 lines (39 loc) · 1.17 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
import { classValidator } from "../../src/adapters/class-validator.js";
import { createApp } from "../../src/index.js";
import { AppModule } from "./app.module.js";
const port = 3_000;
const app = createApp({
schema: classValidator(),
imports: [AppModule],
docs: true,
openapi: {
service: {
name: "complex",
version: "1.0.0",
description: "Capstone: multi-module composition, cross-module DI, @Middleware, and the module viewer. Combines modules, guards, and logging patterns.",
},
},
});
export function rateLimiter(_req: Request, next: () => Promise<Response>) {
return next();
}
Bun.serve({
port: port,
routes: {
...app.routes,
},
fetch: app.fetch,
});
console.table(
Object.entries(app.routes).map(([path, handlers]) => ({
path: path,
methods: Object.keys(handlers).join(", "),
})),
);
console.table([
{ name: "Server", url: `http://localhost:${port}` },
{ name: "Docs Index", url: `http://localhost:${port}/docs/` },
{ name: "Swagger UI", url: `http://localhost:${port}/docs/swagger/` },
{ name: "Module Viewer", url: `http://localhost:${port}/docs/modules/` },
{ name: "Module Viewer SVG", url: `http://localhost:${port}/docs/modules/tree.svg` },
]);