2021-04-07 06:23:47 +00:00
|
|
|
package openapi
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/rakyll/statik/fs"
|
2022-02-14 16:22:30 +00:00
|
|
|
"github.com/rs/cors"
|
2021-04-07 06:23:47 +00:00
|
|
|
|
2022-04-26 23:01:45 +00:00
|
|
|
_ "github.com/zitadel/zitadel/openapi/statik"
|
2021-04-07 06:23:47 +00:00
|
|
|
)
|
|
|
|
|
2022-02-14 16:22:30 +00:00
|
|
|
const (
|
|
|
|
HandlerPrefix = "/openapi/v2/swagger"
|
|
|
|
)
|
|
|
|
|
2021-04-07 06:23:47 +00:00
|
|
|
func Start() (http.Handler, error) {
|
|
|
|
statikFS, err := fs.NewWithNamespace("swagger")
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
handler := &http.ServeMux{}
|
2022-02-14 16:22:30 +00:00
|
|
|
handler.Handle("/", cors.AllowAll().Handler(http.FileServer(statikFS)))
|
2021-04-07 06:23:47 +00:00
|
|
|
return handler, nil
|
|
|
|
}
|