Add static endpoint

This commit is contained in:
2023-10-30 15:19:03 -04:00
parent 1dd0b7caaa
commit 729056b752
3 changed files with 25 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
//use bcrypt::{hash, verify, DEFAULT_COST};
use futures_util::{SinkExt, StreamExt};
use poem::{
endpoint::StaticFilesEndpoint,
//get,
handler,
listener::TcpListener,
@@ -289,6 +290,7 @@ async fn main() -> anyhow::Result<()> {
"Chat",
"0.0",
);
let static_endpoint = StaticFilesEndpoint::new("./client/dist").index_file("index.html");
let app = Route::new()
//.at("/api/", get(index))
@@ -297,6 +299,7 @@ async fn main() -> anyhow::Result<()> {
// get(ws.data(tokio::sync::broadcast::channel::<String>(32).0)),
//)
//.data(dbpool)
.nest("/", static_endpoint)
.nest("/api", api)
.with(session);