Added some routes for users
And some fixes
This commit is contained in:
@@ -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}`))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user