actix setup

This commit is contained in:
FrenchGithubUser
2025-03-12 21:26:54 +01:00
parent 4210c3c4de
commit c7dc1da597
4 changed files with 1549 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
target/

1513
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

7
Cargo.toml Normal file
View File

@@ -0,0 +1,7 @@
[package]
name = "arcadia-index"
version = "0.1.0"
edition = "2024"
[dependencies]
actix-web = "4"

28
src/main.rs Normal file
View File

@@ -0,0 +1,28 @@
use actix_web::{App, HttpResponse, HttpServer, Responder, get, post, web};
#[get("/")]
async fn hello() -> impl Responder {
HttpResponse::Ok().body("Hello world!")
}
#[post("/echo")]
async fn echo(req_body: String) -> impl Responder {
HttpResponse::Ok().body(req_body)
}
async fn manual_hello() -> impl Responder {
HttpResponse::Ok().body("Hey there!")
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
.service(hello)
.service(echo)
.route("/hey", web::get().to(manual_hello))
})
.bind(("127.0.0.1", 8080))?
.run()
.await
}