Implement Basic Web Server

This commit is contained in:
Luke Harding 2024-05-02 19:24:52 -04:00
parent 97711358eb
commit 95c1cf2930
3 changed files with 1327 additions and 2 deletions

1313
server/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -5,3 +5,4 @@ edition = "2021"
license = "GPL-3.0-only" license = "GPL-3.0-only"
[dependencies] [dependencies]
actix-web = "4.5.1"

View File

@ -1,3 +1,14 @@
fn main() { use actix_web::{App, get, HttpResponse, HttpServer, Responder};
println!("Hello, world!");
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| App::new().service(hello))
.bind(("127.0.0.1", 8000))?
.run()
.await
}
#[get("/")]
async fn hello() -> impl Responder {
HttpResponse::Ok().body("Hello World!")
} }