zero4rs 2.0.0

zero4rs is a powerful, pragmatic, and extremely fast web framework for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::prelude2::*;

pub async fn excel_index(
    query: web::Form<HashMap<String, String>>,
    request: HttpRequest,
) -> impl Responder {
    let _file_path = query
        .get("file_path")
        .ok_or_else(|| Error::invalid_request("Missing form data field: file_path"))?;

    match crate::core::excel::excel_to_vec(_file_path, 0) {
        Ok(data) => {
            crate::core::excel::write_excel("/Users/keesh/Desktop/2022.xlsx", &data)?;
            request.json(200, R::ok(data))
        }
        Err(e) => request.json(200, R::failed(500, e.to_string())),
    }
}