diff --git a/go-api/.envrc b/go-api/.envrc new file mode 100644 index 0000000..e89fbf9 --- /dev/null +++ b/go-api/.envrc @@ -0,0 +1 @@ +use flake "git+https://code.oliverdavies.uk/opdavies/dev-shells#go" diff --git a/go-api/main.go b/go-api/main.go new file mode 100644 index 0000000..032aa8a --- /dev/null +++ b/go-api/main.go @@ -0,0 +1,22 @@ +package main + +import ( + "encoding/json" + "fmt" + "net/http" +) + +func handler(w http.ResponseWriter, r *http.Request) { + fmt.Println("Running handler...") + + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + + json.NewEncoder(w).Encode(map[string]any{}) +} + +func main() { + http.HandleFunc("/", handler) + + http.ListenAndServe(":8080", nil) +}