moving to using a rust api
This commit is contained in:
parent
2d1424aeb2
commit
f00ed3a04c
12 changed files with 1044 additions and 272 deletions
26
src/main.rs
Normal file
26
src/main.rs
Normal file
|
@ -0,0 +1,26 @@
|
|||
mod api;
|
||||
|
||||
use actix_multipart::form::tempfile::TempFileConfig;
|
||||
use actix_web::{middleware, App, HttpServer};
|
||||
use api::mt_form::mt_form;
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||
|
||||
log::info!("creating temporary upload directory");
|
||||
std::fs::create_dir_all("./tmp")?;
|
||||
|
||||
log::info!("starting HTTP server at http://localhost:4242");
|
||||
|
||||
HttpServer::new(|| {
|
||||
App::new()
|
||||
.wrap(middleware::Logger::default())
|
||||
.app_data(TempFileConfig::default().directory("./tmp"))
|
||||
.service(mt_form)
|
||||
})
|
||||
.bind(("127.0.0.1", 4242))?
|
||||
.workers(2)
|
||||
.run()
|
||||
.await
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue