ferrum/
server.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
use actix_web::{web, App, HttpServer};
use crate::{upload_file, download_file};

pub async fn start_server() -> std::io::Result<()> {
    HttpServer::new(|| {
        App::new()
            .route("/upload", web::post().to(upload_file))
            .route("/download/{file_name}", web::get().to(download_file))
    })
        .bind("127.0.0.1:8080")?
        .run()
        .await
}