summaryrefslogtreecommitdiff
path: root/pkg/backend/routes.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/backend/routes.go')
-rw-r--r--pkg/backend/routes.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/pkg/backend/routes.go b/pkg/backend/routes.go
new file mode 100644
index 0000000..058febd
--- /dev/null
+++ b/pkg/backend/routes.go
@@ -0,0 +1,22 @@
+package backend
+
+import (
+ "net/http"
+
+ "git.adyxax.org/adyxax/tfstated/pkg/basic_auth"
+ "git.adyxax.org/adyxax/tfstated/pkg/database"
+)
+
+func addRoutes(
+ mux *http.ServeMux,
+ db *database.DB,
+) {
+ mux.Handle("GET /healthz", handleHealthz())
+
+ basicAuth := basic_auth.Middleware(db)
+ mux.Handle("DELETE /", basicAuth(handleDelete(db)))
+ mux.Handle("GET /", basicAuth(handleGet(db)))
+ mux.Handle("LOCK /", basicAuth(handleLock(db)))
+ mux.Handle("POST /", basicAuth(handlePost(db)))
+ mux.Handle("UNLOCK /", basicAuth(handleUnlock(db)))
+}