From 5c99ee71e39e0734819d0afbed4a8c5a34e63f33 Mon Sep 17 00:00:00 2001 From: Lucas Schumacher Date: Thu, 26 Oct 2023 10:33:02 -0400 Subject: [PATCH] Use caddy for dev server --- Caddyfile | 4 ++++ src/main.rs | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 Caddyfile diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..de4103b --- /dev/null +++ b/Caddyfile @@ -0,0 +1,4 @@ +:2000 { + reverse_proxy 127.0.0.1:5173 + reverse_proxy /api/* 127.0.0.1:3000 + } diff --git a/src/main.rs b/src/main.rs index 4a86f90..d3b518d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -97,8 +97,8 @@ async fn main() -> Result<(), std::io::Error> { } tracing_subscriber::fmt::init(); - let app = Route::new().at("/", get(index)).at( - "/ws/:name", + let app = Route::new().at("/api/", get(index)).at( + "/api/ws/:name", get(ws.data(tokio::sync::broadcast::channel::(32).0)), );