portfolio/api/handler/userHandler.go
darius 13358f66b6 First query setup
multiple endpoint setup
2024-02-15 10:04:05 +01:00

26 lines
481 B
Go

package handler
import (
"context"
"net/http"
"portfolio-backend/database/query"
)
func CreateUser(w http.ResponseWriter, r *http.Request) {
_, err := w.Write([]byte("test2"))
if err != nil {
InternalServerErrorHandler(w, r)
}
}
func GetUser(w http.ResponseWriter, r *http.Request) {
user, err := query.GetUser(context.Background())
if err != nil {
return
}
_, err = w.Write([]byte(r.PathValue(user.Name)))
if err != nil {
InternalServerErrorHandler(w, r)
}
}