首次提交
This commit is contained in:
18
src/main.rs
Normal file
18
src/main.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use actix_web::{App, HttpResponse, HttpServer, Responder, get, web};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
HttpServer::new(|| App::new().service(root))
|
||||
.bind(("0.0.0.0", 2018))
|
||||
.unwrap()
|
||||
.run()
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[get("/")]
|
||||
async fn root() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
.content_type("text/html;charset=utf-8")
|
||||
.body("<h1>侯浩彬是我儿子</h1>")
|
||||
}
|
||||
Reference in New Issue
Block a user