diff options
| author | seth <[email protected]> | 2024-07-31 17:03:15 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2024-07-31 17:03:15 -0400 |
| commit | c676c82b55dbcf052987878ba39d40a5c325e16a (patch) | |
| tree | d54e1b3a2461cd17c57c0e7ff3cd208e4a99f26b | |
| parent | d43240003212e9a5b92b936d9a0b90adfb41bdcb (diff) | |
add swagger ui
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | package.json | 1 | ||||
| -rw-r--r-- | pnpm-lock.yaml | 12 | ||||
| -rw-r--r-- | src/index.ts | 3 |
4 files changed, 17 insertions, 1 deletions
@@ -1,3 +1,3 @@ # teawieAPI -okay so like basically, it's just a web service for teawie stuff (so cool!!) +https://api.getchoo.com/swagger diff --git a/package.json b/package.json index a7ef9c5..5b1ff3f 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "fmt": "prettier --write ." }, "dependencies": { + "@hono/swagger-ui": "^0.4.0", "@hono/zod-openapi": "^0.15.1", "@hono/zod-validator": "^0.2.2", "hono": "^4.5.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c8b82ab..4776f33 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: dependencies: + '@hono/swagger-ui': + specifier: ^0.4.0 + version: 0.4.0([email protected]) '@hono/zod-openapi': specifier: ^0.15.1 version: 0.15.1([email protected])([email protected]) @@ -559,6 +562,11 @@ packages: resolution: {integrity: sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ==} engines: {node: '>=14'} + '@hono/[email protected]': + resolution: {integrity: sha512-8lF+dexzgV2HRM1R/gf49E5djroq4jVMYMSwLkSF9pT0I6sYhuqirFDCRFrBtbbLCBsKzw6f2MF5rS+WY3d7Nw==} + peerDependencies: + hono: '*' + '@hono/[email protected]': resolution: {integrity: sha512-2Un3D5xD1j4tIvUwzQ/XkB6xwrEA0Ne23TRjB8UVw0PgUWzsB3xiB8Hl/y2ZEMfcIfrA15/ga4P6Bkct8uYaLg==} engines: {node: '>=16.0.0'} @@ -1682,6 +1690,10 @@ snapshots: '@fastify/[email protected]': {} + '@hono/[email protected]([email protected])': + dependencies: + hono: 4.5.3 + dependencies: '@asteasolutions/zod-to-openapi': 7.1.1([email protected]) diff --git a/src/index.ts b/src/index.ts index 9f2703b..4de8e6d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,6 @@ import { logger } from "hono/logger"; import { prettyJSON } from "hono/pretty-json"; +import { swaggerUI } from "@hono/swagger-ui"; import { OpenAPIHono, createRoute } from "@hono/zod-openapi"; import { VERSION } from "./consts"; import { Bindings, Variables } from "./env"; @@ -19,6 +20,8 @@ app.get("/", (c) => c.redirect(c.env.REDIRECT_ROOT ?? "https://github.com/getchoo/teawieAPI"), ); +app.get("/swagger", swaggerUI({ url: "/doc" })); + app.doc("/doc", { openapi: "3.0.0", info: { |
