diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-11-27 14:09:05 -0500 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-11-27 14:09:05 -0500 |
commit | 0f7b0118c5a8290ed4d230a8e4bfc96daafea116 (patch) | |
tree | 296f322e4bd829a83fe5e1b994b8be53ab497ecb | |
parent | 496cfab1e8867d5a8ff54402b848a6a38d03b1b0 (diff) |
Add consntructor for APIResponse
-rw-r--r-- | backend/main.go | 8 | ||||
-rw-r--r-- | backend/todo.txt | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/backend/main.go b/backend/main.go index 96bb824..4766de2 100644 --- a/backend/main.go +++ b/backend/main.go @@ -20,6 +20,14 @@ type APIResponse struct { Data interface{} } +func MakeAPIResponse(status int, msg string, data interface{}) *APIResponse { + return &APIResponse{ + Status: APIStatus{ + Code: status, + Msg: msg, + }, + Data: data, + } } func RecipeList(w http.ResponseWriter, r *http.Request) { diff --git a/backend/todo.txt b/backend/todo.txt index b2d928b..ae57ec0 100644 --- a/backend/todo.txt +++ b/backend/todo.txt @@ -1,2 +1,3 @@ Refactor Response creation Handle PSV parsing (rm empty string at end, or rm last pipe when creating item) +Fix Update (steps != 0) |