Crates.io | altaria |
lib.rs | altaria |
version | 0.1.301 |
source | src |
created_at | 2024-12-06 17:13:17.851975 |
updated_at | 2024-12-07 01:03:51.021979 |
description | Altaria is an asynchronous, memory-safe, blazingly fast HTTP server written in Rust. It currently supports HTTP1.1 parsing and encoding and HTTP2 parsing. |
homepage | https://github.com/SrGaabriel/altaria |
repository | https://github.com/SrGaabriel/altaria |
max_upload_size | |
id | 1474467 |
size | 58,419 |
Altaria is an asynchronous, memory-safe, blazingly fast HTTP server written in Rust. It currently supports HTTP1.1 parsing and encoding and HTTP2 parsing.
[!IMPORTANT]
This project is made mostly for educational/learning purposes. It is not recommended to use it in production. Maybe in the future, it will be production-ready.
#[tokio::main]
async fn main() {
let handler = function_handler(|_| async {
(HttpStatusCode::OK, "Hello, World!")
});
let router = Router::new()
.add_handler("/", handler)
.add_function_handler("/users/{name}", greet);
Server::builder()
.local_port(8080)
.router(router)
.start()
.await
.unwrap()
}
async fn greet(Path(name): Path<String>, request: HttpRequest) -> impl IntoResponse {
format!("Hello, {}!", name)
}