Effect CommunityEC
Effect Community15mo ago
2 replies
Arman

Customizing Swagger Base URL Path for API Docs

is it possible to change the base url path for swagger docs? For example I managed to mount the HttpApi at a base path as follows:
const myApiBasePath = '/custom-base'
// Instead of HttpApiBuilder.serve
const serve = HttpApiBuilder.httpApp.pipe(
  Effect.map(app =>
    HttpRouter.empty.pipe(
      HttpRouter.mountApp(myApiBasePath, app),
    )
  ),
  Effect.map(HttpServer.serve(HttpMiddleware.logger)),
  Layer.unwrapEffect,
  Layer.provide(HttpApiBuilder.Router.Live),
)


In this setup swagger docs don't have this information as they are generated directly from the api spec, hence
Try it out
does not function. Is there a different way to mount at a different base path or this info needs to be passed to the swagger docs generator? (the docs are mounted under the custom path as well)
Was this page helpful?