MCPcopy Create free account
hub / github.com/actix/examples / main

Function main

forms/multipart/src/main.rs:47–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45
46#[actix_web::main]
47async fn main() -> std::io::Result<()> {
48 env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
49
50 log::info!("creating temporary upload directory");
51 std::fs::create_dir_all("./tmp")?;
52
53 log::info!("starting HTTP server at http://localhost:8080");
54
55 HttpServer::new(|| {
56 App::new()
57 .wrap(middleware::Logger::default())
58 .app_data(TempFileConfig::default().directory("./tmp"))
59 .service(
60 web::resource("/")
61 .route(web::get().to(index))
62 .route(web::post().to(save_files)),
63 )
64 })
65 .bind(("127.0.0.1", 8080))?
66 .workers(2)
67 .run()
68 .await
69}
70
71/// Example of the old manual way of processing multipart forms.
72#[allow(unused)]

Callers

nothing calls this directly

Calls 2

postFunction · 0.85
runMethod · 0.80

Tested by

no test coverage detected