echo-swagger
echo-swagger copied to clipboard
two or more swagger html on the same app
Hi,
In my app, i have endpoints published in the main app ( at the URL /swagger/ ) and i have another one, with admin endpoints (for example)
import (
echoSwagger "github.com/swaggo/echo-swagger"
...
)
On the main...:
url := echoSwagger.URL("admin.json")
echo.GET("/admin/swagger/*", echoSwagger.EchoWrapHandler(url))
echo.GET("/swagger/*", echoSwagger.WrapHandler)
I am finding problems with this solution, cause each time that i load something of "/admin/swagger/", the main swagger stops to work.
Is posible to perform this?
Thanks!!
try
url := echoSwagger.URL("admin.json")
echo.GET("/admin/swagger/*", echoSwagger.EchoWrapHandler(url))
echo.GET("/swagger/*", echoSwagger.EchoWrapHandler())
try
url := echoSwagger.URL("admin.json") echo.GET("/admin/swagger/*", echoSwagger.EchoWrapHandler(url)) echo.GET("/swagger/*", echoSwagger.EchoWrapHandler())
Hi, thanks for reply so quickly.
I tried it, but when i load "admin" swagger on browser, the "main" swagger stops to works and it drops 404. Maybe with this part of code is the problem: https://github.com/swaggo/echo-swagger/blob/f298ba3e5d9a0cfe087b463b285dc648978a6b7a/swagger.go#L53
Thats why i am asking.
:smile: Not really, the problem is caused by the fact we are reusing swaggerFiles.Handler.
Thanks ubogdan for the fast reply!
The issue was addressed and the fix will be included in v1.1.5.