it is TECHNICALLY mvp

main
Bel LaPointe 2025-04-28 22:37:10 -06:00
parent dceebd5755
commit a4eedc7a86
2 changed files with 31 additions and 13 deletions

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
"io" "io"
"log"
"net/http" "net/http"
"strings" "strings"
) )
@ -31,7 +32,9 @@ func (h Handler) serveHTTP(w http.ResponseWriter, r *http.Request) error {
return h.ui(w, r) return h.ui(w, r)
} else if strings.HasPrefix(r.URL.Path, "/experimental/echo") { } else if strings.HasPrefix(r.URL.Path, "/experimental/echo") {
b, _ := io.ReadAll(r.Body) b, _ := io.ReadAll(r.Body)
fmt.Fprintf(w, "%s / %s\n", r.URL.String(), b) s := fmt.Sprintf("%s / %s", r.URL.String(), b)
fmt.Fprintf(w, "%s\n", s)
log.Printf("%s", b)
return nil return nil
} else { } else {
http.NotFound(w, r) http.NotFound(w, r)

View File

@ -1,10 +1,24 @@
<html> <html>
<header>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/dark.css">
</header>
<body> <body>
<h2>Hello templated world</h2> <h2>Feeds</h2>
{{ range feeds }}
feed = {{ . }}
{{ end }}
<div>
{{ range feeds }}
<div>
<h4>{{ .Version.URL }}</h4>
<h5>{{ .Version.Created }} (last {{ .Execution.Executed }})</h5>
<div>@{{ .Version.Cron }} ~"{{ .Version.Pattern }}"</div>
<div>{{ .Version.WebhookMethod }} {{ .Version.WebhookURL }} | {{ .Version.WebhookBody }}</div>
</div>
{{ end }}
</div>
<br>
<div>
<form method="POST" action="/v1/feeds"> <form method="POST" action="/v1/feeds">
{{ range feedsVersionFields }} {{ range feedsVersionFields }}
<div> <div>
@ -14,5 +28,6 @@
{{ end }} {{ end }}
<button type="submit">Submit</button> <button type="submit">Submit</button>
</form> </form>
</div>
</body> </body>
</html> </html>