Macrame/be/main.go
Jesse Malotaux b598a090bc Major Update, registration and authentication of devices works now.
This is the first iteration of the registration of devices and authentication for a couple of endpoints.
This needs to be refactored, the code is a bit of a mess. Also because of testing some endpoints are available for remotes that shouldn't be.
2025-04-04 11:27:19 +02:00

26 lines
386 B
Go

package main
import (
"log"
"net/http"
"be/app"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
apiInit(w, r)
})
log.Println(http.ListenAndServe(":6970", nil))
}
func apiInit(w http.ResponseWriter, r *http.Request) {
app.ApiCORS(w, r)
if r.Method == "GET" {
app.ApiGet(w, r)
} else if r.Method == "POST" {
app.ApiPost(w, r)
}
}