Skip to content

Commit

Permalink
fix: should be appPrefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Hazmi35 committed Nov 29, 2024
1 parent 88ffd3f commit 9ed5bd0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export const swagger = async <Path extends string = '/swagger'>(
}

const app = new Elysia({ name: '@elysiajs/swagger' })
const prefixedPath = join(app.config.prefix ?? "/", path)
const appPrefix = app.config.prefix ?? "/"
const prefixedPath = join(appPrefix, path)

app.get(path, function documentation(request) {
// External Prefix, if the app is behind a reverse proxy
Expand Down Expand Up @@ -137,7 +138,7 @@ export const swagger = async <Path extends string = '/swagger'>(
schema,
hook: route.hooks,
method,
path: join(extPrefix, prefixedPath, route.path),
path: join(extPrefix, appPrefix, route.path),
// @ts-ignore
models: app.definitions?.type,
contentType: route.hooks.type
Expand All @@ -150,7 +151,7 @@ export const swagger = async <Path extends string = '/swagger'>(
schema,
hook: route.hooks,
method: route.method,
path: join(extPrefix, prefixedPath, route.path),
path: join(extPrefix, appPrefix, route.path),
// @ts-ignore
models: app.definitions?.type,
contentType: route.hooks.type
Expand Down

0 comments on commit 9ed5bd0

Please sign in to comment.