首次提交
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/target
|
||||
.idea
|
||||
1675
Cargo.lock
generated
Normal file
1675
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
10
Cargo.toml
Normal file
10
Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "LoggerServer"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
actix = "0.13.5"
|
||||
actix-web = "4.12.1"
|
||||
anyhow = "1.0.100"
|
||||
tokio = { version = "1.49.0", features = ["full"] }
|
||||
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