initial commit that just handles moon phases
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore Thu Dec 08 01:47:05 2022 -0600
@@ -0,0 +1,3 @@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/go.mod Thu Dec 08 01:47:05 2022 -0600
@@ -0,0 +1,5 @@
+module hg.sr.ht/~grim/cerestial +require github.com/janczer/goMoonPhase v0.0.0-20210411203237-6c61017953a8 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/go.sum Thu Dec 08 01:47:05 2022 -0600
@@ -0,0 +1,2 @@
+github.com/janczer/goMoonPhase v0.0.0-20210411203237-6c61017953a8 h1:Dm5ZV6OiMV+c0NcjZZNE/qdyyWLSGP2aI4mt4vBWMS8= +github.com/janczer/goMoonPhase v0.0.0-20210411203237-6c61017953a8/go.mod h1:cP58cMQH4tMoeknficHktMZj5QraEnMIMcR0I9EzuzU= --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.go Thu Dec 08 01:47:05 2022 -0600
@@ -0,0 +1,27 @@
+ moonphase "github.com/janczer/goMoonPhase" +func moon_handler(w http.ResponseWriter, r *http.Request) { + data := map[string]any{ + "moon": map[string]any{ + "phase": moonphase.New(time.Now()).PhaseName(), + w.Header().Set("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + mux := http.NewServeMux() + mux.Handle("/moon", http.HandlerFunc(moon_handler)) + http.ListenAndServe(":3000", mux)