about summary refs log tree commit diff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 6a62dcc..77a6c11 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -4,6 +4,7 @@ mod database;
 mod frontend;
 mod indieauth;
 mod micropub;
+mod metrics;
 
 use crate::indieauth::IndieAuthMiddleware;
 use crate::micropub::CORSMiddleware;
@@ -42,6 +43,7 @@ where
             .build())
     });
     app.at("/")
+        .with(CORSMiddleware {})
         .with(frontend::ErrorHandlerMiddleware {})
         .get(frontend::mainpage)
         .post(frontend::onboarding_receiver);
@@ -54,7 +56,13 @@ where
     app.at("/coffee")
         .with(frontend::ErrorHandlerMiddleware {})
         .get(frontend::coffee);
+    // TODO make sure the health check actually checks the backend or something
+    // otherwise it'll get false-negatives for application faults like resource
+    // exhaustion
     app.at("/health").get(|_| async { Ok("OK") });
+    app.at("/metrics").get(metrics::gather);
+
+    app.with(metrics::InstrumentationMiddleware {});
 
     app
 }