mirror of
https://codeberg.org/JasterV/chat-rooms-actix.git
synced 2026-04-26 18:10:04 +00:00
readme update
This commit is contained in:
parent
7b283dd39e
commit
cad0039166
4 changed files with 61 additions and 6 deletions
51
Cargo.lock
generated
51
Cargo.lock
generated
|
|
@ -1,5 +1,7 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "actix"
|
||||
version = "0.10.0"
|
||||
|
|
@ -125,6 +127,7 @@ dependencies = [
|
|||
"actix-web",
|
||||
"actix-web-actors",
|
||||
"derive_more",
|
||||
"env_logger",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"uuid",
|
||||
|
|
@ -361,6 +364,17 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.0.1"
|
||||
|
|
@ -615,6 +629,19 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17392a012ea30ef05a610aa97dfb49496e71c9f676b27879922ea5bdf60d9d3f"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"humantime",
|
||||
"log",
|
||||
"regex",
|
||||
"termcolor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.20"
|
||||
|
|
@ -858,6 +885,12 @@ version = "1.3.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691"
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.2.2"
|
||||
|
|
@ -1511,6 +1544,15 @@ dependencies = [
|
|||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.24"
|
||||
|
|
@ -1873,6 +1915,15 @@ version = "0.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
|
|
|
|||
|
|
@ -14,3 +14,4 @@ uuid = { version = "0.8", features = ["serde", "v4"] }
|
|||
derive_more = "0.99.11"
|
||||
serde_json = "1.0.64"
|
||||
serde = "1.0.124"
|
||||
env_logger = "0.8.3"
|
||||
10
README.md
10
README.md
|
|
@ -28,8 +28,8 @@ To execute any operation you have to send a json which has the following format:
|
|||
|
||||
```json
|
||||
{
|
||||
"ty": "Create" | "Join" | "Leave" | "Msg",
|
||||
"data": ""
|
||||
"ty": "<type>",
|
||||
"data": "<message>"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ To execute any operation you have to send a json which has the following format:
|
|||
```json
|
||||
{
|
||||
"ty": "Info",
|
||||
"data": <room-id>
|
||||
"data": "<room-id>"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ To execute any operation you have to send a json which has the following format:
|
|||
```json
|
||||
{
|
||||
"ty": "Join",
|
||||
"data": <room-id>
|
||||
"data": "<room-id>"
|
||||
}
|
||||
```
|
||||
+ Response:
|
||||
|
|
@ -96,7 +96,7 @@ If an error occurs, the server will send back a json with the following format:
|
|||
```json
|
||||
{
|
||||
"ty": "Err",
|
||||
"data" <error-message>
|
||||
"data": "<error-message>"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ mod routes;
|
|||
|
||||
use crate::{actors::chat_server::ChatServer, models::AppState};
|
||||
use actix::Actor;
|
||||
use actix_web::{App, HttpServer};
|
||||
use actix_web::{middleware, App, HttpServer};
|
||||
use routes::connect;
|
||||
|
||||
fn get_server_addr() -> String {
|
||||
|
|
@ -16,10 +16,13 @@ fn get_server_addr() -> String {
|
|||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
std::env::set_var("RUST_LOG", "actix_web=info");
|
||||
env_logger::init();
|
||||
let addr = get_server_addr();
|
||||
let chat = ChatServer::new().start();
|
||||
HttpServer::new(move || {
|
||||
App::new()
|
||||
.wrap(middleware::Logger::default())
|
||||
.data(AppState { chat: chat.clone() })
|
||||
.service(connect)
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue