Add httapi server

This commit is contained in:
2026-03-21 22:03:03 -04:00
parent c8458d439b
commit ac6a48cae5
3 changed files with 1558 additions and 0 deletions

1523
did_router/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

7
did_router/Cargo.toml Normal file
View File

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

28
did_router/src/main.rs Normal file
View File

@@ -0,0 +1,28 @@
use actix_web::{get, post, web, App, HttpResponse, HttpServer, Responder};
#[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
}