Skip to navigation
Deliver images via actix_web rust
29.11.22
use actix_web::{ Responder, HttpRequest}; extern crate mssql; pub async fn img(_req: HttpRequest) -> impl Responder { println!("...img"); let _category = _req.match_info().get("category").unwrap_or("10"); let _name = _req.match_info().get("name").unwrap_or("no.png"); println!("Category: {:?}", _category); println!("Name: {:?}", _name); let _path = format!("/mnt/foo/pictures/{_category}/{_name}"); println!("Path: {:?}", _path); let _file = actix_files::NamedFile::open_async(_path).await.unwrap(); _file.into_response(&_req) }
https://actix.rs/
Reply
Anonymous
Information Epoch 1732468001
Looking for the ninety percent solution.
Home
Notebook
Contact us