diff options
| author | mo khan <mo@mokhan.ca> | 2022-05-17 15:16:58 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2022-05-17 15:16:58 -0600 |
| commit | 575ee429db68f968a64a0d2a2b191ebec71a00d1 (patch) | |
| tree | 73b4a36f533a3cff4394f468425c2666465123e8 /cmd/api | |
| parent | c29a2e582bdf038a9e223200b1aca05fa0e09307 (diff) | |
copy fixture data from ui app
Diffstat (limited to 'cmd/api')
| -rw-r--r-- | cmd/api/main.go | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/cmd/api/main.go b/cmd/api/main.go index d0d6961..867d392 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -96,12 +96,70 @@ func main() { w.Write([]byte(`{"message":"incidents"}`)) }) }) + + r.Route("/auth", func(r chi.Router) { + r.Get("/providers", func(w http.ResponseWriter, r *http.Request) { + }) + r.Get("/csrf", func(w http.ResponseWriter, r *http.Request) { + }) + + r.Get("/signin/auth0", func(w http.ResponseWriter, r *http.Request) { + }) + }) r.Route("/notifications", func(r chi.Router) { r.Get("/global", func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) w.Write(readFixture("notifications/global.json")) }) + + r.Get("/{id}", func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + w.Write(readFixture(fmt.Sprintf("notifications/%v.json", chi.URLParam(r, "id")))) + }) + }) + r.Route("/resources", func(r chi.Router) { + r.Get("/{id}", func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + w.Write(readFixture(fmt.Sprintf("resources/%v.json", chi.URLParam(r, "id")))) + }) + }) + r.Route("/atlas", func(r chi.Router) { + r.Get("/", func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + w.Write(readFixture("atlas.json")) + }) + + r.Get("/{id}/capabilities", func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + w.Write(readFixture(fmt.Sprintf("atlas/%v/capabilities.json", chi.URLParam(r, "id")))) + }) + r.Get("/{id}/investigations", func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + w.Write(readFixture(fmt.Sprintf("atlas/%v/investigations.json", chi.URLParam(r, "id")))) + }) + r.Get("/{id}/investigations/{iid}", func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + w.Write(readFixture(fmt.Sprintf("atlas/%v/investigations/%v.json", chi.URLParam(r, "id"), chi.URLParam(r, "iid")))) + }) + r.Get("/{id}/investigations/{iid}/conversation", func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + w.Write(readFixture(fmt.Sprintf("atlas/%v/investigations/%v/conversation.json", chi.URLParam(r, "id"), chi.URLParam(r, "iid")))) + }) + }) + r.Route("/session", func(r chi.Router) { + r.Get("/", func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + w.Write(readFixture("session.json")) + }) }) }) log.Fatal(http.ListenAndServe("localhost:4000", r)) |
