Added some routes for users

And some fixes
This commit is contained in:
cdricms
2025-01-16 10:51:30 +01:00
parent fee9a237c4
commit 9a6e4a7565
7 changed files with 173 additions and 41 deletions

View File

@@ -14,7 +14,7 @@ import (
func HandleGetBlog(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
fmt.Println("salut")
fmt.Println("salut")
emptyObject := make(map[string]interface{})
emptyJSON, json_err := json.Marshal(emptyObject)
@@ -22,14 +22,14 @@ func HandleGetBlog(w http.ResponseWriter, r *http.Request) {
fmt.Println("Couldn't create the json object")
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(emptyJSON))
return
return
}
if r.Method != http.MethodGet {
http.Error(w, "Wrong method", http.StatusMethodNotAllowed)
return
}
blog := &core.Blog{
BaseModel: bun.BaseModel{},
BlogID: [16]byte{},
@@ -53,6 +53,6 @@ func HandleGetBlog(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Can't use select", http.StatusNotFound)
return
}
w.Write([]byte(`{message: "Successfuly responded to request}`))
}