diff --git a/ActixAPI/src/main.rs b/ActixAPI/src/main.rs index 6abe78d..878169d 100644 --- a/ActixAPI/src/main.rs +++ b/ActixAPI/src/main.rs @@ -29,6 +29,17 @@ async fn load_big_image() -> Result { Ok(NamedFile::open(real_path)?) } +#[post("/image/save-big-image")] +async fn save_big_image(image_data: web::Bytes) -> Result { + // Write bytes to file + std::fs::write("image.png", &image_data).unwrap(); + + // Return the blurred image bytes + Ok(HttpResponse::Ok() + .content_type("application/json") + .body("{\"status\": 200}")) +} + #[post("/image/blur")] async fn blur_image(image_data: web::Bytes, req: HttpRequest) -> Result { // Load the image from the incoming bytes @@ -61,7 +72,9 @@ async fn main() -> std::io::Result<()> { .service(hello) .service(load_small_image) .service(load_big_image) + .service(save_big_image) .service(blur_image) + .app_data(web::PayloadConfig::new(1024 * 1024 * 1024)) }) .bind(("0.0.0.0", 5000))? .run()