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"
"fmt"
"io"
"log"
"net/http"
"strings"
)
@ -31,7 +32,9 @@ func (h Handler) serveHTTP(w http.ResponseWriter, r *http.Request) error {
return h.ui(w, r)
} else if strings.HasPrefix(r.URL.Path, "/experimental/echo") {
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
} else {
http.NotFound(w, r)

View File

@ -1,18 +1,33 @@
<html>
<header>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/dark.css">
</header>
<body>
<h2>Hello templated world</h2>
{{ range feeds }}
feed = {{ . }}
{{ end }}
<h2>Feeds</h2>
<form method="POST" action="/v1/feeds">
{{ range feedsVersionFields }}
<div>
<label for="{{ . }}">{{ . }}</label>
<input name="{{ . }}" type="text" />
</div>
<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 }}
<button type="submit">Submit</button>
</form>
</div>
<br>
<div>
<form method="POST" action="/v1/feeds">
{{ range feedsVersionFields }}
<div>
<label for="{{ . }}">{{ . }}</label>
<input name="{{ . }}" type="text" />
</div>
{{ end }}
<button type="submit">Submit</button>
</form>
</div>
</body>
</html>