Skip to content

Commit

Permalink
make --prefix work with Swagger (fixes #820)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmcelhaney committed Apr 30, 2024
1 parent 9f891e3 commit ef57997
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/funny-singers-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"counterfact": patch
---

fixed: make --prefix work with Swagger
1 change: 1 addition & 0 deletions src/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export interface Config {
port: number;
proxyEnabled: boolean;
proxyUrl: string;
routePrefix: string;
}

export const DUMMY_EXPORT_FOR_TEST_COVERAGE = 1;
7 changes: 6 additions & 1 deletion src/server/create-koa-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ export function createKoaApp(
) {
const app = new Koa();

app.use(openapiMiddleware(config.openApiPath, `//localhost:${config.port}`));
app.use(
openapiMiddleware(
config.openApiPath,
`//localhost:${config.port}${config.routePrefix}`,
),
);

app.use(
koaSwagger({
Expand Down

0 comments on commit ef57997

Please sign in to comment.