https://github.com/richerarc/saphir
Fully async-await http server framework
https://github.com/richerarc/saphir
Last synced: 18 days ago
JSON representation
Fully async-await http server framework
- Host: GitHub
- URL: https://github.com/richerarc/saphir
- Owner: richerarc
- License: mit
- Created: 2018-06-01T04:48:53.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-05-14T15:40:48.000Z (11 months ago)
- Last Synced: 2024-09-17T01:14:19.271Z (7 months ago)
- Language: Rust
- Homepage:
- Size: 715 KB
- Stars: 91
- Watchers: 9
- Forks: 14
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-rust-cn - Saphir - level control, without the pain. (Libraries / Web programming)
- awesome-rust - Saphir - level control, without the pain. (Libraries / Web programming)
- awesome-rust - Saphir - level control, without the pain. (Libraries / Web programming)
- awesome-rust-cn - Saphir
- awesome-rust-zh - Saphir - 一个渐进式的网络框架,具有低层的控制,没有痛苦。 (库 / 网页编程)
README
# ![logo]
[](https://docs.rs/saphir/)
[](https://crates.io/crates/saphir)
[](https://github.com/richerarc/saphir/issues)


[](https://github.com/richerarc/saphir/blob/master/LICENSE)
[](https://deps.rs/repo/github/richerarc/saphir)### Saphir is a fully async-await http server framework for rust
The goal is to give low-level control to your web stack (as hyper does) without the time consuming task of doing everything from scratch.## Quick Overview
```rust
use saphir::prelude::*;
struct TestController {}
#[controller]
impl TestController {
#[get("/{var}/print")]
async fn print_test(&self, var: String) -> (u16, String) {
(200, var)
}
}
async fn test_handler(mut req: Request) -> (u16, Option) {
(200, req.captures_mut().remove("variable"))
}
#[tokio::main]
async fn main() -> Result<(), SaphirError> {
env_logger::init();
let server = Server::builder()
.configure_listener(|l| {
l.interface("127.0.0.1:3000")
})
.configure_router(|r| {
r.route("/{variable}/print", Method::GET, test_handler)
.controller(TestController {})
})
.build();
server.run().await
}
```[logo]: ./logo.svg "Saphir Logo"