Add a webhook endpoint.

This commit is contained in:
Tom Alexander
2024-07-14 16:13:06 -04:00
parent 8fb5a83e86
commit ab5db8aded
3 changed files with 242 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
use axum::http::StatusCode;
use axum::routing::get;
use axum::routing::post;
use axum::Json;
use axum::Router;
use serde::Serialize;
@@ -7,6 +8,10 @@ use tower_http::trace::TraceLayer;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
use self::webhook::hook;
mod webhook;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing_subscriber::registry()
@@ -19,6 +24,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.init();
let app = Router::new()
.route("/health", get(health))
.route("/hook", post(hook))
.layer(TraceLayer::new_for_http());
let listener = tokio::net::TcpListener::bind("0.0.0.0:8080").await?;