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