first working server

This commit is contained in:
$(pass /github/name)
2024-07-03 09:40:45 +02:00
parent 9bd8d48243
commit 6d34d99835
20 changed files with 340 additions and 128 deletions

View File

@@ -1,13 +1,17 @@
package middlewares
import (
"net/http"
"net/http"
)
func AuthMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Authentication logic here
next.ServeHTTP(w, r)
})
return http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
token := r.Header.Get("Authorization")
if token != "your-secret-token" {
http.Error(w, "Forbidden", http.StatusForbidden)
return
}
next.ServeHTTP(w, r)
})
}