first commit server

This commit is contained in:
2025-05-10 22:05:57 +02:00
parent 2380a36271
commit 15b1efcc48
3 changed files with 39 additions and 1 deletions

20
cmd/server/api/api.go Normal file
View File

@@ -0,0 +1,20 @@
package api
import (
"net/http"
"github.com/99designs/basicauth-go"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
)
func New(htaccess map[string][]string) *chi.Mux {
r := chi.NewRouter()
r.Use(middleware.Logger)
r.Use(basicauth.New("basic", htaccess))
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello World!"))
})
return r
}