Skip to content

Commit

Permalink
/ go to swagger doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu Lefebvre committed Oct 24, 2023
1 parent 84ab7fa commit 9a908a4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 41 deletions.
25 changes: 0 additions & 25 deletions src/banner.ts

This file was deleted.

9 changes: 2 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ import { getTotalSupply, getContract, getBalance } from "./queries";
import config from "./config";
import { HTTPException } from "hono/http-exception";

import { banner } from "./banner";

export function generateApp() {
const app = new OpenAPIHono();

app.use("/swagger/*", serveStatic({ root: "./" }));
app.use("/", serveStatic({ root: "./swagger" }));

app.doc("/openapi", {
openapi: "3.0.0",
Expand All @@ -44,11 +43,7 @@ export function generateApp() {
return c.json({ error_message }, error_code);
});

app.openapi(routes.indexRoute, (c) => {
return {
response: c.text(banner()),
} as TypedResponse<string>;
});


app.openapi(routes.TotalSupplyQueryRoute, async (c) => {
// @ts-expect-error: Suppress type of parameter expected to be never (see https://github.com/honojs/middleware/issues/200)
Expand Down
10 changes: 1 addition & 9 deletions src/routes.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import { createRoute } from "@hono/zod-openapi";
import * as schemas from "./schemas";

export const indexRoute = createRoute({
method: "get",
path: "/",
responses: {
200: {
description: "Index page banner.",
},
},
});


export const TotalSupplyQueryRoute = createRoute({
method: "get",
Expand Down

0 comments on commit 9a908a4

Please sign in to comment.