Add static endpoint
This commit is contained in:
parent
1dd0b7caaa
commit
729056b752
21
Cargo.lock
generated
21
Cargo.lock
generated
@ -1023,6 +1023,16 @@ version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
||||
|
||||
[[package]]
|
||||
name = "mime_guess"
|
||||
version = "2.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef"
|
||||
dependencies = [
|
||||
"mime",
|
||||
"unicase",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "minimal-lexical"
|
||||
version = "0.2.1"
|
||||
@ -1271,8 +1281,10 @@ dependencies = [
|
||||
"futures-util",
|
||||
"headers",
|
||||
"http",
|
||||
"httpdate",
|
||||
"hyper",
|
||||
"mime",
|
||||
"mime_guess",
|
||||
"multer",
|
||||
"parking_lot",
|
||||
"percent-encoding",
|
||||
@ -2269,6 +2281,15 @@ dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicase"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89"
|
||||
dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.13"
|
||||
|
||||
@ -4,7 +4,7 @@ version = "1.3.58"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
poem = { version = "1.3.58", features = ["websocket", "session", "anyhow"] }
|
||||
poem = { version = "1.3.58", features = ["websocket", "session", "anyhow", "static-files"] }
|
||||
tokio = { version = "1.17.0", features = ["rt-multi-thread", "macros"] }
|
||||
futures-util = "0.3.17"
|
||||
tracing-subscriber = { version ="0.3.9", features = ["env-filter"] }
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user