summaryrefslogtreecommitdiff
path: root/backend/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/main.go')
-rw-r--r--backend/main.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/backend/main.go b/backend/main.go
new file mode 100644
index 0000000..7b66e00
--- /dev/null
+++ b/backend/main.go
@@ -0,0 +1,29 @@
+package main
+
+import "fmt"
+import "net/http"
+
+func RecipeList(w http.ResponseWriter, r *http.Request) {
+ if r.Method == "GET" {
+ fmt.Printf("Return all recipe names...\n")
+ } else if r.Method == "POST" {
+ } else if r.Method == "DELETE" {
+ }
+}
+
+func HandleRecipe(w http.ResponseWriter, r *http.Request) {
+ name := r.URL.Path[len("/recipes/"):]
+ if r.Method == "GET" {
+ fmt.Printf("Return recipe \"%s\"...\n", name)
+ } else if r.Method == "POST" {
+ fmt.Printf("Create recipe \"%s\"...\n", name)
+ } else if r.Method == "DELETE" {
+ fmt.Printf("Delete recipe \"%s\"...\n", name)
+ }
+}
+
+func main() {
+ http.HandleFunc("/recipes", RecipeList)
+ http.HandleFunc("/recipes/", HandleRecipe)
+ http.ListenAndServe(":8888", nil)
+}