Skip to content

Fully async-await http server framework

License

Notifications You must be signed in to change notification settings

Recurse-blip/saphir

This branch is 6 commits behind richerarc/saphir:master.

Folders and files

NameName
Last commit message
Last commit date
Jul 6, 2021
Jan 10, 2023
Feb 8, 2023
Jan 9, 2023
Feb 28, 2020
Jan 9, 2023
Jun 1, 2018
Apr 21, 2020
Oct 24, 2022
Apr 21, 2020
Jan 18, 2022

Repository files navigation

logo

doc crate issue Rust downloads license dependency status

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

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<String>) {
    (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
}

About

Fully async-await http server framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 99.9%
  • Other 0.1%