err
cicd / ci (push) Successful in 2m8s Details

main
Bel LaPointe 2025-10-06 07:29:12 -06:00
parent 38786d3b1a
commit d3e98d543e
1 changed files with 14 additions and 12 deletions

View File

@ -25,19 +25,21 @@ type (
func run() error { func run() error {
f := os.Args[1] f := os.Args[1]
return http.ListenAndServe(":3001", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
b, err := os.ReadFile(f) b, err := os.ReadFile(f)
if err != nil { if err != nil {
return err http.Error(w, err.Error(), http.StatusInternalServerError)
return
} }
type Route struct { type Route struct {
} }
var data Data var data Data
if err := yaml.Unmarshal(b, &data); err != nil { if err := yaml.Unmarshal(b, &data); err != nil {
return err http.Error(w, err.Error(), http.StatusInternalServerError)
return
} }
return http.ListenAndServe(":3001", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
k := r.URL.Path k := r.URL.Path
v, ok := data.Routes[k] v, ok := data.Routes[k]