Implement Basic Web Server
This commit is contained in:
parent
97711358eb
commit
95c1cf2930
1313
server/Cargo.lock
generated
1313
server/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -5,3 +5,4 @@ edition = "2021"
|
|||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
actix-web = "4.5.1"
|
||||||
|
@ -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!")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user