Compare commits
3 Commits
5b51404a4c
...
bcdbcef636
| Author | SHA1 | Date | |
|---|---|---|---|
| bcdbcef636 | |||
| 5c99ee71e3 | |||
| db5aa38ccb |
4
Caddyfile
Normal file
4
Caddyfile
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
:2000 {
|
||||||
|
reverse_proxy 127.0.0.1:5173
|
||||||
|
reverse_proxy /api/* 127.0.0.1:3000
|
||||||
|
}
|
||||||
804
Cargo.lock
generated
804
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -8,3 +8,4 @@ poem = { version = "1.3.58", features = ["websocket"]}
|
|||||||
tokio = { version = "1.17.0", features = ["rt-multi-thread", "macros"] }
|
tokio = { version = "1.17.0", features = ["rt-multi-thread", "macros"] }
|
||||||
futures-util = "0.3.17"
|
futures-util = "0.3.17"
|
||||||
tracing-subscriber = { version ="0.3.9", features = ["env-filter"] }
|
tracing-subscriber = { version ="0.3.9", features = ["env-filter"] }
|
||||||
|
sqlx = { version = "0.7.2", features = ["runtime-tokio", "sqlite"] }
|
||||||
|
|||||||
@ -42,7 +42,7 @@ fn index() -> Html<&'static str> {
|
|||||||
sendForm.hidden = false;
|
sendForm.hidden = false;
|
||||||
msgsArea.hidden = false;
|
msgsArea.hidden = false;
|
||||||
msgInput.focus();
|
msgInput.focus();
|
||||||
ws = new WebSocket("ws://127.0.0.1:3000/ws/" + nameInput.value);
|
ws = new WebSocket("ws://127.0.0.1:2000/api/ws/" + nameInput.value);
|
||||||
ws.onmessage = function(event) {
|
ws.onmessage = function(event) {
|
||||||
msgsArea.value += event.data + "\r\n";
|
msgsArea.value += event.data + "\r\n";
|
||||||
}
|
}
|
||||||
@ -97,8 +97,8 @@ async fn main() -> Result<(), std::io::Error> {
|
|||||||
}
|
}
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
|
|
||||||
let app = Route::new().at("/", get(index)).at(
|
let app = Route::new().at("/api/", get(index)).at(
|
||||||
"/ws/:name",
|
"/api/ws/:name",
|
||||||
get(ws.data(tokio::sync::broadcast::channel::<String>(32).0)),
|
get(ws.data(tokio::sync::broadcast::channel::<String>(32).0)),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user