Add broker-service

This commit is contained in:
Dan Jones 2025-05-16 15:35:44 -05:00
commit 60aeac4f4b
Signed by: dan
GPG key ID: 5B3B0F7217473A29
5 changed files with 90 additions and 0 deletions

View file

@ -0,0 +1,29 @@
package main
import (
"net/http"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/go-chi/cors"
)
func (app *Config) routes() http.Handler {
mux := chi.NewRouter()
// Who is allowed
mux.Use(cors.Handler(cors.Options{
AllowedOrigins: []string{"https://*", "https://*"},
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
AllowedHeaders: []string{"Accept", "", "Authorization", "Content-Type", "X-CSRF-Token"},
ExposedHeaders: []string{"Link"},
AllowCredentials: true,
MaxAge: 300,
}))
mux.Use(middleware.Heartbeat("/ping"))
mux.Post("/", app.Broker)
return mux
}