first commit

This commit is contained in:
Adrian Zürcher
2026-01-16 07:51:28 +01:00
commit 4d9e0836e5
15 changed files with 764 additions and 0 deletions

26
handlers/scheduler.go Normal file
View File

@@ -0,0 +1,26 @@
package handlers
import (
"encoding/json"
"net/http"
"os"
)
type Schedule map[string]interface{}
func SaveSchedule(w http.ResponseWriter, r *http.Request) {
var s Schedule
json.NewDecoder(r.Body).Decode(&s)
data, _ := json.Marshal(s)
os.WriteFile("schedule.json", data, 0644)
w.WriteHeader(http.StatusOK)
}
func GetSchedule(w http.ResponseWriter, r *http.Request) {
data, err := os.ReadFile("schedule.json")
if err != nil {
json.NewEncoder(w).Encode(Schedule{})
return
}
w.Write(data)
}