Skip to content

Instantly share code, notes, and snippets.

@proclaim
Last active March 13, 2018 09:39
Show Gist options
  • Save proclaim/7bcb56a0acac797946a85f43fac03076 to your computer and use it in GitHub Desktop.
Save proclaim/7bcb56a0acac797946a85f43fac03076 to your computer and use it in GitHub Desktop.
caddy-reverse-proxy-tutorial-app2
package main
import (
"fmt"
"net/http"
)
// handleFoodApi will take care any data related to food
func handleFoodApi(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`{"success":true, "data":"SECRET_INGREDIENT"}`))
}
func main() {
http.HandleFunc("/api/food", handleFoodApi)
fmt.Println("ready at localhost:8800/api/food")
http.ListenAndServe(":8800", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment