Skip to content

Issue when using prefix in Elysia #15

@mentos1386

Description

@mentos1386

When using Elysia like this:

import { Elysia } from "elysia";
import { swagger } from "@elysiajs/swagger";

const app = new Elysia({ prefix: "/api" }).use(
  swagger({
    path: "/swagger",
  })
);

app.get("/", (ctx) => ctx.headers);

app.listen({ port: 3003, hostname: "0.0.0.0" });
console.log(
  `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`
);

One would expect that swagger would be exposed at /api/swagger. Which it is, but opening the page you get the following error:
slika

The JSON is resolvable at /api/swagger/json, under the /api prefix as expected, but the swagger try to fetch it from /swagger/json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions