Skip to content

Commit

Permalink
fix: add baseURL to openapi generated url (#2049)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcremer-able authored Jan 4, 2024
1 parent 9eeb9d8 commit 1e8910d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/runtime/routes/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ import type {
PathsObject,
} from "openapi-typescript";
import { handlersMeta } from "#internal/nitro/virtual/server-handlers";
import { useRuntimeConfig } from "#internal/nitro";

// Served as /_nitro/openapi.json
export default eventHandler((event) => {
const base = useRuntimeConfig()?.app?.baseURL;

return <OpenAPI3>{
openapi: "3.0.0",
info: {
Expand All @@ -18,7 +21,7 @@ export default eventHandler((event) => {
},
servers: [
{
url: "http://localhost:3000",
url: `http://localhost:3000${base}`,
description: "Local Development Server",
variables: {},
},
Expand Down

0 comments on commit 1e8910d

Please sign in to comment.