switch server to rust based since it's much easier

This commit is contained in:
Chris Cochrun 2023-05-26 16:21:21 -05:00
parent 465b2de7f2
commit 09f3ea62f2
7 changed files with 1974 additions and 18 deletions

25
src/main.rs Normal file
View file

@ -0,0 +1,25 @@
use std::{env, io};
use actix_web::{middleware, web, App, HttpServer, get, post, Responder, http::header::ContentType, HttpResponse, HttpRequest, http::{StatusCode, Method}};
#[actix_web::main]
async fn main() -> io::Result<()> {
env::set_var("RUST_LOG", "actix_web=debug,actix_server=info");
env_logger::init();
HttpServer::new(|| {
App::new()
// enable logger - always register actix-web Logger middleware last
.wrap(middleware::Logger::default())
// register HTTP requests handlers
.service(form)
})
.bind("0.0.0.0:4242")?
.run()
.await
}
#[post("/health-form")]
async fn form(req: HttpRequest) -> HttpResponse {
println!("{req:?}");
HttpResponse::Ok().respond_to(&req)
}