create-daloy 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/create-daloy.mjs +1 -1
- package/package.json +1 -1
- package/templates/bun-basic/README.md +1 -1
- package/templates/bun-basic/package.json +2 -2
- package/templates/bun-basic/src/build-app.ts +11 -38
- package/templates/bun-basic/src/index.ts +1 -1
- package/templates/cloudflare-worker/package.json +1 -1
- package/templates/deno-basic/README.md +1 -1
- package/templates/deno-basic/deno.json +2 -2
- package/templates/deno-basic/src/build-app.ts +11 -38
- package/templates/deno-basic/src/main.ts +1 -1
- package/templates/node-basic/README.md +1 -1
- package/templates/node-basic/package.json +2 -2
- package/templates/node-basic/src/build-app.ts +13 -42
- package/templates/node-basic/src/index.ts +1 -1
- package/templates/vercel-edge/README.md +2 -2
- package/templates/vercel-edge/api/[...path].ts +9 -41
- package/templates/vercel-edge/package.json +1 -1
package/README.md
CHANGED
|
@@ -112,7 +112,7 @@ A [Deno](https://deno.com) runtime starter using `@daloyjs/core/deno` with:
|
|
|
112
112
|
## Minimal scaffolds
|
|
113
113
|
|
|
114
114
|
Pass `--minimal` to drop the bookstore demo route and the built-in
|
|
115
|
-
`/docs` + `/openapi.json`
|
|
115
|
+
`/docs` + `/openapi.json` API docs routes from any template that supports
|
|
116
116
|
them. The scaffolded app is left with the framework bootstrap and a single
|
|
117
117
|
`/healthz` route — the smallest realistic starting point:
|
|
118
118
|
|
package/bin/create-daloy.mjs
CHANGED
|
@@ -316,7 +316,7 @@ ${heading("Options")}
|
|
|
316
316
|
${color(COLORS.green, "--list-templates")} Print available templates and exit.
|
|
317
317
|
${color(COLORS.green, "--install / --no-install")} Install dependencies after scaffolding.
|
|
318
318
|
${color(COLORS.green, "--git / --no-git")} Initialize a git repository.
|
|
319
|
-
${color(COLORS.green, "--minimal")} Strip the bookstore +
|
|
319
|
+
${color(COLORS.green, "--minimal")} Strip the bookstore + OpenAPI docs demo routes.
|
|
320
320
|
${color(COLORS.green, "--with-ci / --no-ci")} Add hardened GitHub Actions + governance files.
|
|
321
321
|
${color(COLORS.green, "--code-owner <owner>")} CODEOWNERS owner for --with-ci, e.g. @acme/security.
|
|
322
322
|
${color(COLORS.green, "--force")} Overwrite an existing non-empty directory.
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ curl http://localhost:3000/books/1
|
|
|
21
21
|
<!-- daloy-minimal:strip-start docs -->
|
|
22
22
|
## API documentation
|
|
23
23
|
|
|
24
|
-
-
|
|
24
|
+
- API docs (Scalar): <http://localhost:3000/docs>
|
|
25
25
|
- OpenAPI 3.1 JSON: <http://localhost:3000/openapi.json>
|
|
26
26
|
<!-- daloy-minimal:strip-end docs -->
|
|
27
27
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"bun": ">=1.1.0"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"dev": "
|
|
10
|
+
"dev": "daloy dev --runtime bun",
|
|
11
11
|
"start": "bun src/index.ts",
|
|
12
12
|
"typecheck": "tsc --noEmit",
|
|
13
13
|
"test": "bun test",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"gen": "pnpm gen:openapi && pnpm gen:client"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@daloyjs/core": "^0.
|
|
19
|
+
"@daloyjs/core": "^0.13.0",
|
|
20
20
|
"zod": "^4.4.3"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
@@ -6,10 +6,6 @@ import {
|
|
|
6
6
|
requestId,
|
|
7
7
|
secureHeaders,
|
|
8
8
|
} from "@daloyjs/core";
|
|
9
|
-
// daloy-minimal:strip-start docs
|
|
10
|
-
import { generateOpenAPI } from "@daloyjs/core/openapi";
|
|
11
|
-
import { htmlResponse, swaggerUiHtml } from "@daloyjs/core/docs";
|
|
12
|
-
// daloy-minimal:strip-end docs
|
|
13
9
|
|
|
14
10
|
/**
|
|
15
11
|
* Build the application as a pure factory so the same `App` is reused by
|
|
@@ -22,6 +18,17 @@ export function buildApp(): App {
|
|
|
22
18
|
bodyLimitBytes: 1024 * 1024,
|
|
23
19
|
requestTimeoutMs: 5_000,
|
|
24
20
|
production: process.env.NODE_ENV === "production",
|
|
21
|
+
// daloy-minimal:strip-start docs
|
|
22
|
+
// Auto-mounted docs:
|
|
23
|
+
// GET /openapi.json — live OpenAPI 3.1 spec generated from your routes
|
|
24
|
+
// GET /docs — Scalar API reference UI that loads it
|
|
25
|
+
// `info.title` / `info.version` are pulled from package.json by default;
|
|
26
|
+
// set `openapi.info` here to override them.
|
|
27
|
+
openapi: {
|
|
28
|
+
servers: [{ url: `http://localhost:${process.env.PORT ?? 3000}` }],
|
|
29
|
+
},
|
|
30
|
+
docs: true,
|
|
31
|
+
// daloy-minimal:strip-end docs
|
|
25
32
|
});
|
|
26
33
|
|
|
27
34
|
app.use(requestId());
|
|
@@ -70,40 +77,6 @@ export function buildApp(): App {
|
|
|
70
77
|
});
|
|
71
78
|
// daloy-minimal:strip-end books
|
|
72
79
|
|
|
73
|
-
// daloy-minimal:strip-start docs
|
|
74
|
-
app.route({
|
|
75
|
-
method: "GET",
|
|
76
|
-
path: "/openapi.json",
|
|
77
|
-
operationId: "getOpenAPI",
|
|
78
|
-
tags: ["Docs"],
|
|
79
|
-
responses: { 200: { description: "OpenAPI 3.1 document" } },
|
|
80
|
-
handler: async () => ({
|
|
81
|
-
status: 200 as const,
|
|
82
|
-
body: generateOpenAPI(app, {
|
|
83
|
-
info: { title: "My Daloy Bun API", version: "0.0.1" },
|
|
84
|
-
servers: [{ url: `http://localhost:${process.env.PORT ?? 3000}` }],
|
|
85
|
-
}),
|
|
86
|
-
}),
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
app.route({
|
|
90
|
-
method: "GET",
|
|
91
|
-
path: "/docs",
|
|
92
|
-
operationId: "docs",
|
|
93
|
-
tags: ["Docs"],
|
|
94
|
-
responses: { 200: { description: "API reference UI" } },
|
|
95
|
-
handler: async () => {
|
|
96
|
-
const html = swaggerUiHtml({ specUrl: "/openapi.json", title: "My Daloy Bun API" });
|
|
97
|
-
const res = htmlResponse(html);
|
|
98
|
-
return {
|
|
99
|
-
status: 200 as const,
|
|
100
|
-
body: html,
|
|
101
|
-
headers: Object.fromEntries(res.headers),
|
|
102
|
-
};
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
// daloy-minimal:strip-end docs
|
|
106
|
-
|
|
107
80
|
return app;
|
|
108
81
|
}
|
|
109
82
|
|
|
@@ -14,7 +14,7 @@ const handle = serve(app, {
|
|
|
14
14
|
const url = handle.url ? String(handle.url) : `http://localhost:${port}`;
|
|
15
15
|
const links: StartupBannerLink[] = [
|
|
16
16
|
// daloy-minimal:strip-start docs
|
|
17
|
-
{ label: "
|
|
17
|
+
{ label: "API docs", url: `${url}/docs` },
|
|
18
18
|
{ label: "OpenAPI JSON", url: `${url}/openapi.json` },
|
|
19
19
|
// daloy-minimal:strip-end docs
|
|
20
20
|
{ label: "Health", url: `${url}/healthz` },
|
|
@@ -20,7 +20,7 @@ curl http://localhost:3000/books/1
|
|
|
20
20
|
<!-- daloy-minimal:strip-start docs -->
|
|
21
21
|
## API documentation
|
|
22
22
|
|
|
23
|
-
-
|
|
23
|
+
- API docs (Scalar): <http://localhost:3000/docs>
|
|
24
24
|
- OpenAPI 3.1 JSON: <http://localhost:3000/openapi.json>
|
|
25
25
|
<!-- daloy-minimal:strip-end docs -->
|
|
26
26
|
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"gen:openapi": "deno run --allow-net --allow-env --allow-read --allow-write scripts/dump-openapi.ts"
|
|
9
9
|
},
|
|
10
10
|
"imports": {
|
|
11
|
-
"@daloyjs/core": "npm:@daloyjs/core@^0.
|
|
12
|
-
"@daloyjs/core/": "npm:@daloyjs/core@^0.
|
|
11
|
+
"@daloyjs/core": "npm:@daloyjs/core@^0.13.0",
|
|
12
|
+
"@daloyjs/core/": "npm:@daloyjs/core@^0.13.0/",
|
|
13
13
|
"zod": "npm:zod@^4.4.3"
|
|
14
14
|
},
|
|
15
15
|
"compilerOptions": {
|
|
@@ -6,10 +6,6 @@ import {
|
|
|
6
6
|
requestId,
|
|
7
7
|
secureHeaders,
|
|
8
8
|
} from "@daloyjs/core";
|
|
9
|
-
// daloy-minimal:strip-start docs
|
|
10
|
-
import { generateOpenAPI } from "@daloyjs/core/openapi";
|
|
11
|
-
import { htmlResponse, swaggerUiHtml } from "@daloyjs/core/docs";
|
|
12
|
-
// daloy-minimal:strip-end docs
|
|
13
9
|
|
|
14
10
|
/**
|
|
15
11
|
* Build the application as a pure factory.
|
|
@@ -23,6 +19,17 @@ export function buildApp(): App {
|
|
|
23
19
|
bodyLimitBytes: 1024 * 1024,
|
|
24
20
|
requestTimeoutMs: 5_000,
|
|
25
21
|
production: Deno.env.get("DENO_ENV") === "production",
|
|
22
|
+
// daloy-minimal:strip-start docs
|
|
23
|
+
// Auto-mounted docs:
|
|
24
|
+
// GET /openapi.json — live OpenAPI 3.1 spec generated from your routes
|
|
25
|
+
// GET /docs — Scalar API reference UI that loads it
|
|
26
|
+
// `info.title` / `info.version` are pulled from deno.json by default;
|
|
27
|
+
// set `openapi.info` here to override them.
|
|
28
|
+
openapi: {
|
|
29
|
+
servers: [{ url: `http://localhost:${Deno.env.get("PORT") ?? "3000"}` }],
|
|
30
|
+
},
|
|
31
|
+
docs: true,
|
|
32
|
+
// daloy-minimal:strip-end docs
|
|
26
33
|
});
|
|
27
34
|
|
|
28
35
|
app.use(requestId());
|
|
@@ -71,40 +78,6 @@ export function buildApp(): App {
|
|
|
71
78
|
});
|
|
72
79
|
// daloy-minimal:strip-end books
|
|
73
80
|
|
|
74
|
-
// daloy-minimal:strip-start docs
|
|
75
|
-
app.route({
|
|
76
|
-
method: "GET",
|
|
77
|
-
path: "/openapi.json",
|
|
78
|
-
operationId: "getOpenAPI",
|
|
79
|
-
tags: ["Docs"],
|
|
80
|
-
responses: { 200: { description: "OpenAPI 3.1 document" } },
|
|
81
|
-
handler: async () => ({
|
|
82
|
-
status: 200 as const,
|
|
83
|
-
body: generateOpenAPI(app, {
|
|
84
|
-
info: { title: "My Daloy Deno API", version: "0.0.1" },
|
|
85
|
-
servers: [{ url: `http://localhost:${Deno.env.get("PORT") ?? "3000"}` }],
|
|
86
|
-
}),
|
|
87
|
-
}),
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
app.route({
|
|
91
|
-
method: "GET",
|
|
92
|
-
path: "/docs",
|
|
93
|
-
operationId: "docs",
|
|
94
|
-
tags: ["Docs"],
|
|
95
|
-
responses: { 200: { description: "API reference UI" } },
|
|
96
|
-
handler: async () => {
|
|
97
|
-
const html = swaggerUiHtml({ specUrl: "/openapi.json", title: "My Daloy Deno API" });
|
|
98
|
-
const res = htmlResponse(html);
|
|
99
|
-
return {
|
|
100
|
-
status: 200 as const,
|
|
101
|
-
body: html,
|
|
102
|
-
headers: Object.fromEntries(res.headers),
|
|
103
|
-
};
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
// daloy-minimal:strip-end docs
|
|
107
|
-
|
|
108
81
|
return app;
|
|
109
82
|
}
|
|
110
83
|
|
|
@@ -11,7 +11,7 @@ serve(app, {
|
|
|
11
11
|
const url = `http://${hostname}:${actualPort}`;
|
|
12
12
|
const links: StartupBannerLink[] = [
|
|
13
13
|
// daloy-minimal:strip-start docs
|
|
14
|
-
{ label: "
|
|
14
|
+
{ label: "API docs", url: `${url}/docs` },
|
|
15
15
|
{ label: "OpenAPI JSON", url: `${url}/openapi.json` },
|
|
16
16
|
// daloy-minimal:strip-end docs
|
|
17
17
|
{ label: "Health", url: `${url}/healthz` },
|
|
@@ -21,7 +21,7 @@ curl http://localhost:3000/books/1
|
|
|
21
21
|
<!-- daloy-minimal:strip-start docs -->
|
|
22
22
|
## API documentation
|
|
23
23
|
|
|
24
|
-
-
|
|
24
|
+
- API docs (Scalar): <http://localhost:3000/docs>
|
|
25
25
|
- OpenAPI 3.1 JSON: <http://localhost:3000/openapi.json>
|
|
26
26
|
|
|
27
27
|
The spec is generated live from your routes, so it stays in sync with what is actually deployed.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"node": ">=24.15.0"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"dev": "
|
|
10
|
+
"dev": "daloy dev",
|
|
11
11
|
"start": "node --import tsx/esm src/index.ts",
|
|
12
12
|
"build": "tsc -p tsconfig.build.json",
|
|
13
13
|
"typecheck": "tsc --noEmit",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"audit": "pnpm audit --prod"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@daloyjs/core": "^0.
|
|
21
|
+
"@daloyjs/core": "^0.13.0",
|
|
22
22
|
"zod": "^4.4.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
@@ -6,10 +6,6 @@ import {
|
|
|
6
6
|
requestId,
|
|
7
7
|
secureHeaders,
|
|
8
8
|
} from "@daloyjs/core";
|
|
9
|
-
// daloy-minimal:strip-start docs
|
|
10
|
-
import { generateOpenAPI } from "@daloyjs/core/openapi";
|
|
11
|
-
import { htmlResponse, swaggerUiHtml } from "@daloyjs/core/docs";
|
|
12
|
-
// daloy-minimal:strip-end docs
|
|
13
9
|
|
|
14
10
|
/**
|
|
15
11
|
* Build the application as a pure factory.
|
|
@@ -24,6 +20,19 @@ export function buildApp(): App {
|
|
|
24
20
|
bodyLimitBytes: 1024 * 1024,
|
|
25
21
|
requestTimeoutMs: 5_000,
|
|
26
22
|
production: process.env.NODE_ENV === "production",
|
|
23
|
+
// daloy-minimal:strip-start docs
|
|
24
|
+
// Auto-mounted docs:
|
|
25
|
+
// GET /openapi.json — live OpenAPI 3.1 spec generated from your routes
|
|
26
|
+
// GET /docs — Scalar API reference UI that loads it
|
|
27
|
+
// `docs: true` always mounts. Use `docs: "auto"` to mount only when
|
|
28
|
+
// `NODE_ENV !== "production"`, or `docs: false` to disable entirely.
|
|
29
|
+
// `info.title` / `info.version` are pulled from package.json by default;
|
|
30
|
+
// set `openapi.info` here to override them.
|
|
31
|
+
openapi: {
|
|
32
|
+
servers: [{ url: `http://localhost:${process.env.PORT ?? 3000}` }],
|
|
33
|
+
},
|
|
34
|
+
docs: true,
|
|
35
|
+
// daloy-minimal:strip-end docs
|
|
27
36
|
});
|
|
28
37
|
|
|
29
38
|
app.use(requestId());
|
|
@@ -72,44 +81,6 @@ export function buildApp(): App {
|
|
|
72
81
|
});
|
|
73
82
|
// daloy-minimal:strip-end books
|
|
74
83
|
|
|
75
|
-
// daloy-minimal:strip-start docs
|
|
76
|
-
// --- API documentation ---------------------------------------------------
|
|
77
|
-
// `/openapi.json` returns the live OpenAPI 3.1 spec generated from the
|
|
78
|
-
// routes defined above. `/docs` serves a Swagger UI page that loads it.
|
|
79
|
-
|
|
80
|
-
app.route({
|
|
81
|
-
method: "GET",
|
|
82
|
-
path: "/openapi.json",
|
|
83
|
-
operationId: "getOpenAPI",
|
|
84
|
-
tags: ["Docs"],
|
|
85
|
-
responses: { 200: { description: "OpenAPI 3.1 document" } },
|
|
86
|
-
handler: async () => ({
|
|
87
|
-
status: 200 as const,
|
|
88
|
-
body: generateOpenAPI(app, {
|
|
89
|
-
info: { title: "My Daloy API", version: "0.0.1" },
|
|
90
|
-
servers: [{ url: `http://localhost:${process.env.PORT ?? 3000}` }],
|
|
91
|
-
}),
|
|
92
|
-
}),
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
app.route({
|
|
96
|
-
method: "GET",
|
|
97
|
-
path: "/docs",
|
|
98
|
-
operationId: "docs",
|
|
99
|
-
tags: ["Docs"],
|
|
100
|
-
responses: { 200: { description: "API reference UI" } },
|
|
101
|
-
handler: async () => {
|
|
102
|
-
const html = swaggerUiHtml({ specUrl: "/openapi.json", title: "My Daloy API" });
|
|
103
|
-
const res = htmlResponse(html);
|
|
104
|
-
return {
|
|
105
|
-
status: 200 as const,
|
|
106
|
-
body: html,
|
|
107
|
-
headers: Object.fromEntries(res.headers),
|
|
108
|
-
};
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
// daloy-minimal:strip-end docs
|
|
112
|
-
|
|
113
84
|
return app;
|
|
114
85
|
}
|
|
115
86
|
|
|
@@ -10,7 +10,7 @@ serve(app, { port });
|
|
|
10
10
|
const url = `http://localhost:${port}`;
|
|
11
11
|
const links: StartupBannerLink[] = [
|
|
12
12
|
// daloy-minimal:strip-start docs
|
|
13
|
-
{ label: "
|
|
13
|
+
{ label: "API docs", url: `${url}/docs` },
|
|
14
14
|
{ label: "OpenAPI JSON", url: `${url}/openapi.json` },
|
|
15
15
|
// daloy-minimal:strip-end docs
|
|
16
16
|
{ label: "Health", url: `${url}/healthz` },
|
|
@@ -21,7 +21,7 @@ curl http://localhost:3000/books/1
|
|
|
21
21
|
<!-- daloy-minimal:strip-start docs -->
|
|
22
22
|
## API documentation
|
|
23
23
|
|
|
24
|
-
-
|
|
24
|
+
- API docs (Scalar): <http://localhost:3000/docs>
|
|
25
25
|
- OpenAPI 3.1 JSON: <http://localhost:3000/openapi.json>
|
|
26
26
|
|
|
27
27
|
After deploying, the same routes serve `/docs` and `/openapi.json` from your Vercel Edge URL.
|
|
@@ -61,5 +61,5 @@ That catch-all API route lets DaloyJS own routing while Vercel handles the runti
|
|
|
61
61
|
- A health route and a contract-first `/books/:id` route with Zod validation.
|
|
62
62
|
<!-- daloy-minimal:strip-end books -->
|
|
63
63
|
<!-- daloy-minimal:strip-start docs -->
|
|
64
|
-
-
|
|
64
|
+
- A Scalar API reference UI at `/docs` and a live OpenAPI 3.1 document at `/openapi.json`.
|
|
65
65
|
<!-- daloy-minimal:strip-end docs -->
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { App, NotFoundError, requestId, secureHeaders } from "@daloyjs/core";
|
|
3
3
|
import { toWebHandler } from "@daloyjs/core/vercel";
|
|
4
|
-
// daloy-minimal:strip-start docs
|
|
5
|
-
import { generateOpenAPI } from "@daloyjs/core/openapi";
|
|
6
|
-
import { htmlResponse, swaggerUiHtml } from "@daloyjs/core/docs";
|
|
7
|
-
// daloy-minimal:strip-end docs
|
|
8
4
|
|
|
9
5
|
// This template defaults to Vercel's Edge runtime for compatibility with the
|
|
10
6
|
// existing `vercel-edge` starter. For Vercel's recommended Node.js runtime,
|
|
@@ -15,6 +11,15 @@ const app = new App({
|
|
|
15
11
|
bodyLimitBytes: 256 * 1024,
|
|
16
12
|
requestTimeoutMs: 5_000,
|
|
17
13
|
production: process.env.NODE_ENV === "production",
|
|
14
|
+
// daloy-minimal:strip-start docs
|
|
15
|
+
// Auto-mounted docs:
|
|
16
|
+
// GET /openapi.json — live OpenAPI 3.1 spec generated from your routes
|
|
17
|
+
// GET /docs — Scalar API reference UI that loads it
|
|
18
|
+
openapi: {
|
|
19
|
+
info: { title: "My Daloy Edge API", version: "0.0.1" },
|
|
20
|
+
},
|
|
21
|
+
docs: true,
|
|
22
|
+
// daloy-minimal:strip-end docs
|
|
18
23
|
});
|
|
19
24
|
|
|
20
25
|
app.use(requestId());
|
|
@@ -61,41 +66,4 @@ app.route({
|
|
|
61
66
|
});
|
|
62
67
|
// daloy-minimal:strip-end books
|
|
63
68
|
|
|
64
|
-
// daloy-minimal:strip-start docs
|
|
65
|
-
// --- API documentation -----------------------------------------------------
|
|
66
|
-
// `/openapi.json` returns the OpenAPI 3.1 spec generated from the routes above.
|
|
67
|
-
// `/docs` serves a Swagger UI page that loads that spec.
|
|
68
|
-
|
|
69
|
-
app.route({
|
|
70
|
-
method: "GET",
|
|
71
|
-
path: "/openapi.json",
|
|
72
|
-
operationId: "getOpenAPI",
|
|
73
|
-
tags: ["Docs"],
|
|
74
|
-
responses: { 200: { description: "OpenAPI 3.1 document" } },
|
|
75
|
-
handler: async () => ({
|
|
76
|
-
status: 200 as const,
|
|
77
|
-
body: generateOpenAPI(app, {
|
|
78
|
-
info: { title: "My Daloy Edge API", version: "0.0.1" },
|
|
79
|
-
}),
|
|
80
|
-
}),
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
app.route({
|
|
84
|
-
method: "GET",
|
|
85
|
-
path: "/docs",
|
|
86
|
-
operationId: "docs",
|
|
87
|
-
tags: ["Docs"],
|
|
88
|
-
responses: { 200: { description: "API reference UI" } },
|
|
89
|
-
handler: async () => {
|
|
90
|
-
const html = swaggerUiHtml({ specUrl: "/openapi.json", title: "My Daloy Edge API" });
|
|
91
|
-
const res = htmlResponse(html);
|
|
92
|
-
return {
|
|
93
|
-
status: 200 as const,
|
|
94
|
-
body: html,
|
|
95
|
-
headers: Object.fromEntries(res.headers),
|
|
96
|
-
};
|
|
97
|
-
},
|
|
98
|
-
});
|
|
99
|
-
// daloy-minimal:strip-end docs
|
|
100
|
-
|
|
101
69
|
export default toWebHandler(app);
|