-
-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swagger Plugin Not Working With Elysia Prefix #1071
Comments
Both the app and swagger plugin have a prefix, so both of them get joined together in one route. In your example, the swagger API can be accessed at Tangent: even at that endpoint, the documentation is still empty, and I think it's because the client (HTML template) is looking for the wrong JSON endpoint. The client tries to GET import { Elysia } from "elysia";
import { swagger } from "@elysiajs/swagger";
const authController = new Elysia({
prefix: "/auth",
}).post("/signup", () => 1);
const v1 = new Elysia({ prefix: "/app/api/v1" }).use(authController);
new Elysia()
.use(swagger({ path: "/app/api/v1/swagger" }))
.use(v1)
.listen(3000); Fixing that would require resolving the full path instead of just the Possible solutions:
|
This issue seems to be fixed by elysiajs/elysia-swagger#185. I think it should be closed. |
thank you @goldenstein64 closing issue |
What version of Elysia is running?
1.2.15 and elysia/swagger version 1.2.1
What platform is your computer?
NixOS
What steps can reproduce the bug?
Instantiate a new Elysia instance with a prefix, add swagger plugin and some routes. Then navigate to the swagger path.
Here's a one-pager. Copy this into index.ts and run
Then navigate to localhost:3000/app/api/v1/swagger. You can see in console it throws a 404 not found for this swagger path.
I've also tried leaving swagger plugin empty (with defaults) so
.use(swagger())
but this results in an empty swagger page that is trying to fetch the data from /swagger/jsonWhat is the expected behavior?
Swagger page should display all routes
What do you see instead?
404 not found error
Additional information
No response
Have you try removing the
node_modules
andbun.lockb
and try again yet?yes
The text was updated successfully, but these errors were encountered: