Started working on the blogs

This commit is contained in:
cdricms
2025-02-21 17:49:42 +01:00
parent de828d4c13
commit 7a97961fef
9 changed files with 178 additions and 79 deletions

View File

@@ -3,7 +3,6 @@ package blogs
import (
"context"
"encoding/json"
"io"
"net/http"
core "fr.latosa-escrima/core"
@@ -11,14 +10,6 @@ import (
)
func HandleNew(w http.ResponseWriter, r *http.Request) {
_, err := io.ReadAll(r.Body)
if err != nil {
core.JSONError{
Status: core.Error,
Message: err.Error(),
}.Respond(w, http.StatusNoContent)
return
}
var blog models.Blog
if err := json.NewDecoder(r.Body).Decode(&blog); err != nil {
core.JSONError{