initial commit

This commit is contained in:
Nick Bland
2021-10-22 12:38:38 +10:00
commit 0466015771
6 changed files with 1807 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
use actix_web::{web, App, HttpResponse, HttpServer};
use actix_web::dev::Server;
use std::net::TcpListener;
async fn health_check() -> HttpResponse {
HttpResponse::Ok().finish()
}
pub fn run(listener: TcpListener) -> Result<Server, std::io::Error> {
let server = HttpServer::new(|| {
App::new()
.route("/health_check", web::get().to(health_check))
})
.listen(listener)?
.run();
Ok(server)
}
+10
View File
@@ -0,0 +1,10 @@
use mail_app::run;
use std::net::TcpListener;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
let listener = TcpListener::bind("127.0.0.1:8000").expect("Failed to bind to 8000");
run(listener)?.await
}