diff --git a/src/index.ts b/src/index.ts index ed15ce1..e4d75ee 100644 --- a/src/index.ts +++ b/src/index.ts @@ -46,11 +46,11 @@ export const swagger = ...documentation.info } - const pathWithPrefix = `${app.config.prefix}${path}` + const relativePath = path.startsWith('/') ? path.slice(1) : path app.get(path, () => { const combinedSwaggerOptions = { - url: `${pathWithPrefix}/json`, + url: `${relativePath}/json`, dom_id: '#swagger-ui', ...swaggerOptions }