Skip to content

Commit 7832405

Browse files
committed
fix: get the prefix from the rootApp
1 parent 20f92b5 commit 7832405

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const swagger = async <Path extends string = '/swagger'>(
4747
excludeMethods: ['OPTIONS'],
4848
excludeTags: []
4949
}
50-
) => {
50+
) => (rootApp: Elysia) => {
5151
const schema = {}
5252
let totalRoutes = 0
5353

@@ -62,7 +62,7 @@ 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 prefixedPath = join(rootApp.config.prefix ?? "/", path)
6666

6767
app.get(path, function documentation(request) {
6868
// External Prefix, if the app is behind a reverse proxy
@@ -191,4 +191,4 @@ export const swagger = async <Path extends string = '/swagger'>(
191191
}
192192

193193
export type { ElysiaSwaggerConfig }
194-
export default swagger
194+
export default swagger

0 commit comments

Comments
 (0)