1
0
mirror of https://github.com/actix/examples synced 2025-06-28 18:00:37 +02:00

migrate websocket-chat example

This commit is contained in:
Nikolay Kim
2019-12-15 22:55:54 +06:00
parent 5ffbaacdce
commit e166c66f0b
5 changed files with 42 additions and 25 deletions

View File

@ -60,7 +60,10 @@ async fn add(
/// This handler manually parse json object. Bytes object supports FromRequest trait (extractor)
/// and could be loaded from request payload automatically
async fn index_add(body: web::Bytes, pool: web::Data<Pool>) -> Result<HttpResponse, Error> {
async fn index_add(
body: web::Bytes,
pool: web::Data<Pool>,
) -> Result<HttpResponse, Error> {
// body is loaded, now we can deserialize id with serde-json
let r_obj = serde_json::from_slice::<MyUser>(&body);