Files
leonwww/protocol/library/examples/tls_server.rs
Leonmmcoset a508e3cefd
Some checks failed
Build Gurty / Build Gurty (, ubuntu-latest, linux, x86_64-unknown-linux-gnu) (push) Failing after 1m33s
Build GurtCA / Build GurtCA (, ubuntu-latest, linux, x86_64-unknown-linux-gnu) (push) Failing after 11m20s
Build GDExtension / Build GDExtension (libgurt_godot.so, ubuntu-latest, linux, x86_64-unknown-linux-gnu) (push) Failing after 16m9s
Build Flumi / Build Flumi (Linux, 4.4.1, ubuntu-latest, linux) (push) Failing after 2h10m11s
Build Flumi / Build Flumi (Windows Desktop, 4.4.1, windows-latest, windows) (push) Has been cancelled
Build GDExtension / Build GDExtension (gurt_godot.dll, windows-latest, windows, x86_64-pc-windows-msvc) (push) Has been cancelled
Build GurtCA / Build GurtCA (.exe, windows-latest, windows, x86_64-pc-windows-msvc) (push) Has been cancelled
Build Gurty / Build Gurty (.exe, windows-latest, windows, x86_64-pc-windows-msvc) (push) Has been cancelled
update
2025-11-06 20:02:53 +08:00

18 lines
632 B
Rust

use gurtlib::{GurtServer, GurtResponse, ServerContext, Result};
#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt::init();
let server = GurtServer::with_tls_certificates("cert.pem", "cert.key.pem")?
.get("/", |_ctx: &ServerContext| async {
Ok(GurtResponse::ok().with_string_body("<h1>Hello from GURT!</h1>"))
})
.get("/test", |_ctx: &ServerContext| async {
Ok(GurtResponse::ok().with_string_body("Test endpoint working!"))
});
println!("Starting GURT server on lw://127.0.0.1:4878");
server.listen("127.0.0.1:4878").await
}