2021-04-07 06:23:47 +00:00
|
|
|
package openapi
|
|
|
|
|
|
|
|
import (
|
2023-07-17 08:08:20 +00:00
|
|
|
"embed"
|
2021-04-07 06:23:47 +00:00
|
|
|
"net/http"
|
|
|
|
|
2022-02-14 16:22:30 +00:00
|
|
|
"github.com/rs/cors"
|
2021-04-07 06:23:47 +00:00
|
|
|
)
|
|
|
|
|
2022-02-14 16:22:30 +00:00
|
|
|
const (
|
|
|
|
HandlerPrefix = "/openapi/v2/swagger"
|
|
|
|
)
|
|
|
|
|
2023-07-17 08:08:20 +00:00
|
|
|
//go:embed v2/zitadel/*
|
|
|
|
var openapi embed.FS
|
|
|
|
|
2021-04-07 06:23:47 +00:00
|
|
|
func Start() (http.Handler, error) {
|
|
|
|
handler := &http.ServeMux{}
|
2023-07-17 08:08:20 +00:00
|
|
|
handler.Handle("/", cors.AllowAll().Handler(http.FileServer(http.FS(openapi))))
|
2021-04-07 06:23:47 +00:00
|
|
|
return handler, nil
|
|
|
|
}
|