Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/richerarc/saphir
Fully async-await http server framework
https://github.com/richerarc/saphir
Last synced: 1 day 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 (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-14T15:40:48.000Z (8 months ago)
- Last Synced: 2024-09-17T01:14:19.271Z (4 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]
[![doc](https://docs.rs/saphir/badge.svg)](https://docs.rs/saphir/)
[![crate](https://img.shields.io/crates/v/saphir.svg)](https://crates.io/crates/saphir)
[![issue](https://img.shields.io/github/issues/richerarc/saphir.svg)](https://github.com/richerarc/saphir/issues)
![Rust](https://github.com/richerarc/saphir/workflows/Rust/badge.svg?branch=master)
![downloads](https://img.shields.io/crates/d/saphir.svg)
[![license](https://img.shields.io/crates/l/saphir.svg)](https://github.com/richerarc/saphir/blob/master/LICENSE)
[![dependency status](https://deps.rs/repo/github/richerarc/saphir/status.svg)](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"