Some cleanup

This commit is contained in:
2023-10-03 19:53:56 +02:00
parent 9a55b024b2
commit b1e2d17dd1
3 changed files with 125 additions and 116 deletions

View File

@@ -2,6 +2,7 @@ package main
import (
"fmt"
"net/http"
"os"
"time"
)
@@ -16,3 +17,11 @@ func checkError(err error) {
v, _ := time.Now().UTC().MarshalText()
f.WriteString(fmt.Sprintf("[%s] %s\n", string(v), err))
}
func cors(fs http.Handler) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
(w).Header().Set("Access-Control-Allow-Origin", "*")
fs.ServeHTTP(w, r)
}
}