Skip to content

Commit 50bc7ff

Browse files
committed
fix: should be appPrefix
1 parent 4c9f204 commit 50bc7ff

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
@@ -134,7 +135,7 @@ export const swagger = async <Path extends string = '/swagger'>(
134135
schema,
135136
hook: route.hooks,
136137
method,
137-
path: join(extPrefix, prefixedPath, route.path),
138+
path: join(extPrefix, appPrefix, route.path),
138139
// @ts-ignore
139140
models: app.definitions?.type,
140141
contentType: route.hooks.type
@@ -147,7 +148,7 @@ export const swagger = async <Path extends string = '/swagger'>(
147148
schema,
148149
hook: route.hooks,
149150
method: route.method,
150-
path: join(extPrefix, prefixedPath, route.path),
151+
path: join(extPrefix, appPrefix, route.path),
151152
// @ts-ignore
152153
models: app.definitions?.type,
153154
contentType: route.hooks.type

0 commit comments

Comments
 (0)