Skip to content

Commit 9ed5bd0

Browse files
committed
fix: should be appPrefix
1 parent 88ffd3f commit 9ed5bd0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ export const swagger = async <Path extends string = '/swagger'>(
6262
}
6363

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

6768
app.get(path, function documentation(request) {
6869
// External Prefix, if the app is behind a reverse proxy
@@ -137,7 +138,7 @@ export const swagger = async <Path extends string = '/swagger'>(
137138
schema,
138139
hook: route.hooks,
139140
method,
140-
path: join(extPrefix, prefixedPath, route.path),
141+
path: join(extPrefix, appPrefix, route.path),
141142
// @ts-ignore
142143
models: app.definitions?.type,
143144
contentType: route.hooks.type
@@ -150,7 +151,7 @@ export const swagger = async <Path extends string = '/swagger'>(
150151
schema,
151152
hook: route.hooks,
152153
method: route.method,
153-
path: join(extPrefix, prefixedPath, route.path),
154+
path: join(extPrefix, appPrefix, route.path),
154155
// @ts-ignore
155156
models: app.definitions?.type,
156157
contentType: route.hooks.type

0 commit comments

Comments
 (0)