Fully async-await http server framework

Related tags

Web Servers saphir
Overview

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
}
Comments
  • Feature: openapi doc gen

    Feature: openapi doc gen

    Create a saphir_cli command line utility for saphir, and add to it the doc-gen function for generating openapi v3 documentation automatically from a saphir project using #[controller] macros.

    opened by Samuel-B-D 9
  • [BUG] Server can't be run due to lack of  Send trait on run() future

    [BUG] Server can't be run due to lack of Send trait on run() future

    Description The following simple code snippet fails on compilation when trying to use saphir 2.8.0 alongside with tokio 0.3.4

    use saphir::server::Server;
    use tokio::runtime::Runtime;
    
    fn main() {
        let server = Server::builder().build();
        tokio::spawn(server.run());
    }
    
    [package]
    name = "saphir-test"
    version = "0.1.0"
    edition = "2018"
    
    [dependencies]
    tokio = { version = "=0.3.4", features = [ "rt" ]}
    saphir = "=2.8"
    

    This code fails due to the following error:

    error[E0277]: `(dyn Future<Output = ()> + Unpin + 'static)` cannot be sent between threads safely
       --> src\main.rs:6:5
        |
    6   |     tokio::spawn(server.run());
        |     ^^^^^^^^^^^^ `(dyn Future<Output = ()> + Unpin + 'static)` cannot be sent between threads safely
        | 
       ::: C:\Users\pacmancoder\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-0.3.4\src\task\spawn.rs:128:21
        |
    128 |         T: Future + Send + 'static,
        |                     ---- required by this bound in `tokio::spawn`
        |
        = help: the trait `Send` is not implemented for `(dyn Future<Output = ()> + Unpin + 'static)`
        = note: required because of the requirements on the impl of `Send` for `Unique<(dyn Future<Output = ()> + Unpin + 'static)>`
        = note: required because it appears within the type `Box<(dyn Future<Output = ()> + Unpin + 'static)>`
        = note: required because it appears within the type `Pin<Box<(dyn Future<Output = ()> + Unpin + 'static)>>`
        = note: required because it appears within the type `saphir::server::ServerShutdown`
        = note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36, 't37, 't38, 't39, 't40, 't41, 't42, 't43, 't44, 't45, 't46, 't47, 't48, 't49, 't50, 't51, 't52, 't53, 't54, 't55, 't56, 't57, 't58> {ResumeTy, saphir::server::Server, ListenerConfig, saphir::server::Stack, HeaderValue, Option<usize>, &'r saphir::server::Stack, saphir::hyper::server::conn::Http, &'s String, String, impl Future, (), tokio::net::tcp::listener::TcpListener, SocketAddr, tokio::net::tcp::incoming::Incoming<'t0>, saphir::server::ServerShutdown, Arc<saphir::server::SeverShutdownState>, Option<u64>, u64, futures_util::stream::stream::for_each_concurrent::ForEachConcurrent<tokio::net::tcp::incoming::Incoming<'t1>, impl Future, [closure@saphir::server::Server::run::{closure#0}::{closure#1}]>, saphir::server::ServerFuture<futures_util::stream::stream::for_each_concurrent::ForEachConcurrent<tokio::net::tcp::incoming::Incoming<'t17>, impl Future, [closure@saphir::server::Server::run::{closure#0}::{closure#1}]>, saphir::server::ServerShutdown>, futures_util::stream::stream::for_each_concurrent::ForEachConcurrent<tokio::net::tcp::incoming::Incoming<'t33>, impl Future, [closure@saphir::server::Server::run::{closure#0}::{closure#2}]>, saphir::server::ServerFuture<futures_util::stream::stream::for_each_concurrent::ForEachConcurrent<tokio::net::tcp::incoming::Incoming<'t46>, impl Future, [closure@saphir::server::Server::run::{closure#0}::{closure#2}]>, saphir::server::ServerShutdown>}`
        = note: required because it appears within the type `[static generator@saphir::server::Server::run::{closure#0} for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36, 't37, 't38, 't39, 't40, 't41, 't42, 't43, 't44, 't45, 't46, 't47, 't48, 't49, 't50, 't51, 't52, 't53, 't54, 't55, 't56, 't57, 't58> {ResumeTy, saphir::server::Server, ListenerConfig, saphir::server::Stack, HeaderValue, Option<usize>, &'r saphir::server::Stack, saphir::hyper::server::conn::Http, &'s String, String, impl Future, (), tokio::net::tcp::listener::TcpListener, SocketAddr, tokio::net::tcp::incoming::Incoming<'t0>, saphir::server::ServerShutdown, Arc<saphir::server::SeverShutdownState>, Option<u64>, u64, futures_util::stream::stream::for_each_concurrent::ForEachConcurrent<tokio::net::tcp::incoming::Incoming<'t1>, impl Future, [closure@saphir::server::Server::run::{closure#0}::{closure#1}]>, saphir::server::ServerFuture<futures_util::stream::stream::for_each_concurrent::ForEachConcurrent<tokio::net::tcp::incoming::Incoming<'t17>, impl Future, [closure@saphir::server::Server::run::{closure#0}::{closure#1}]>, saphir::server::ServerShutdown>, futures_util::stream::stream::for_each_concurrent::ForEachConcurrent<tokio::net::tcp::incoming::Incoming<'t33>, impl Future, [closure@saphir::server::Server::run::{closure#0}::{closure#2}]>, saphir::server::ServerFuture<futures_util::stream::stream::for_each_concurrent::ForEachConcurrent<tokio::net::tcp::incoming::Incoming<'t46>, impl Future, [closure@saphir::server::Server::run::{closure#0}::{closure#2}]>, saphir::server::ServerShutdown>}]`
        = note: required because it appears within the type `from_generator::GenFuture<[static generator@saphir::server::Server::run::{closure#0} for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5, 't6, 't7, 't8, 't9, 't10, 't11, 't12, 't13, 't14, 't15, 't16, 't17, 't18, 't19, 't20, 't21, 't22, 't23, 't24, 't25, 't26, 't27, 't28, 't29, 't30, 't31, 't32, 't33, 't34, 't35, 't36, 't37, 't38, 't39, 't40, 't41, 't42, 't43, 't44, 't45, 't46, 't47, 't48, 't49, 't50, 't51, 't52, 't53, 't54, 't55, 't56, 't57, 't58> {ResumeTy, saphir::server::Server, ListenerConfig, saphir::server::Stack, HeaderValue, Option<usize>, &'r saphir::server::Stack, saphir::hyper::server::conn::Http, &'s String, String, impl Future, (), tokio::net::tcp::listener::TcpListener, SocketAddr, tokio::net::tcp::incoming::Incoming<'t0>, saphir::server::ServerShutdown, Arc<saphir::server::SeverShutdownState>, Option<u64>, u64, futures_util::stream::stream::for_each_concurrent::ForEachConcurrent<tokio::net::tcp::incoming::Incoming<'t1>, impl Future, [closure@saphir::server::Server::run::{closure#0}::{closure#1}]>, saphir::server::ServerFuture<futures_util::stream::stream::for_each_concurrent::ForEachConcurrent<tokio::net::tcp::incoming::Incoming<'t17>, impl Future, [closure@saphir::server::Server::run::{closure#0}::{closure#1}]>, saphir::server::ServerShutdown>, futures_util::stream::stream::for_each_concurrent::ForEachConcurrent<tokio::net::tcp::incoming::Incoming<'t33>, impl Future, [closure@saphir::server::Server::run::{closure#0}::{closure#2}]>, saphir::server::ServerFuture<futures_util::stream::stream::for_each_concurrent::ForEachConcurrent<tokio::net::tcp::incoming::Incoming<'t46>, impl Future, [closure@saphir::server::Server::run::{closure#0}::{closure#2}]>, saphir::server::ServerShutdown>}]>`
        = note: required because it appears within the type `impl Future`
        = note: required because it appears within the type `impl Future`
    
    error: aborting due to previous error; 1 warning emitted
    

    However, on version 2.7.7 of saphir everything works as expected.

    Expected behavior The provided snippet can be run with saphir 2.8.0 the same way it works with saphir 2.7.7

    Additional info (please complete the following information):

    • OS & OS Version: Windows 10 rev.2004
    • Saphir Version: 2.8.0
    • Rust toolchain & version: stable 1.48
    bug 
    opened by pacmancoder 3
  • Feature: implement `tracing` logs as a feature

    Feature: implement `tracing` logs as a feature

    the request tracing is integrated into the handler code instead of as a middleware to be able to wrap the FileMiddleware log span within the request span regardless of middleware order.

    This PR also fix controller macro's handler span so that tracing span within the macro output have proper line numbers, instead of pointing to the top #[controller] macro.

    opened by Samuel-B-D 2
  • [BUG]can not complie

    [BUG]can not complie

    Description A clear and concise description of what the bug is. saphir v2.6.7 error[E0277]: the trait bound hyper::body::body::Body: std::convert::From<std::boxed::Box<dyn futures_core::stream::Stream<Item = std::result::Result<bytes::bytes::Bytes, std::boxed::Box<dyn std::error::Error + std::marker::Send + std::marker::Sync>>> + std::marker::Send + std::marker::Sync>> is not satisfied --> /home/guoyibin3/.cargo/registry/src/github.com-1ecc6299db9ec823/saphir-2.6.7/src/response.rs:374:18 | 374 | self.body(Box::new(file.into()) | ^^^^ the trait std::convert::From<std::boxed::Box<dyn futures_core::stream::Stream<Item = std::result::Result<bytes::bytes::Bytes, std::boxed::Box<dyn std::error::Error + std::marker::Send + std::marker::Sync>>> + std::marker::Send + std::marker::Sync>> is not implemented for hyper::body::body::Body | = help: the following implementations were found: <hyper::body::body::Body as std::convert::From<&'static [u8]>> <hyper::body::body::Body as std::convert::From<&'static str>> <hyper::body::body::Body as std::convert::Frombytes::bytes::Bytes> <hyper::body::body::Body as std::convert::From<std::borrow::Cow<'static, [u8]>>> and 4 others = note: required because of the requirements on the impl of std::convert::Into<hyper::body::body::Body> for std::boxed::Box<dyn futures_core::stream::Stream<Item = std::result::Result<bytes::bytes::Bytes, std::boxed::Box<dyn std::error::Error + std::marker::Send + std::marker::Sync>>> + std::marker::Send + std::marker::Sync>

    error: aborting due to previous error

    For more information about this error, try rustc --explain E0277. error: could not compile saphir. Expected behavior A clear and concise description of what you expected to happen.

    Additional info (please complete the following information):

    • OS & OS Version: [ubuntu 20]
    • Saphir Version [2.0.0]
    • Rust toolchain & version [1.43.1 (8d69840ab 2020-05-04) ]
    opened by gyb997 2
  • chore: update dependancies

    chore: update dependancies

    Removed nom and changed the multipart implementation to use multer instead of updating our legacy nom 5.0 parser.

    @richerarc multer was used instead of the multipart lib we talked about because multipart is in maintenance mode for old sync hyper versions, but doesn't support newer async APIs. The async variant in the crate multipart-async aimed to support newer Hyper versions is a work-in-progress and is not stable yet.

    Meanwhile, the multer crate integration works well (our old example still works well, I took care to maintain the same API surface) and I additionally tested in a separate test project + Insomnia. Also, multer seems to be maintained by the author of rocket.rs

    I also added a cargo-deny configuration to lint the dependancies; I updated all our dependancies to pass the advisories check.

    opened by Samuel-B-D 1
  • Update uuid requirement from 0.8 to 1.2

    Update uuid requirement from 0.8 to 1.2

    Updates the requirements on uuid to permit the latest version.

    Release notes

    Sourced from uuid's releases.

    1.2.1

    What's Changed

    Full Changelog: https://github.com/uuid-rs/uuid/compare/1.2.0...1.2.1

    Commits
    • b87760d Merge pull request #637 from KodrAus/cargo/1.2.1
    • b21f0cb prepare for 1.2.1 release
    • cac99f5 Merge pull request #636 from KodrAus/fix/v1-breakage
    • 9f823fe fix some links in the docs
    • 8c17f33 fix up lost re-export of v1 Timestamp
    • 399e878 Merge pull request #634 from KodrAus/cargo/1.2.0
    • 2db1a64 ensure docs.rs includes unstable APIs
    • 406617d prepare for 1.2.0 release
    • 2e3245f add a test for sorting
    • 8df6494 Merge pull request #633 from KodrAus/feat/unstable-versions
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Feature: request validators

    Feature: request validators

    Added an optional feature flag to automatically validate request Json/Form payloads with the https://github.com/Keats/validator crate.

    The macro is not re-exported through saphir because of path resolution issue in the resulting generated code (I had a long discussion with some macro experts on the official rust discord and ended up to the conclusion that it isn't feasible without adding some significant changes inside the validator crate itself, which wouldn't be welcome by them).

    So, the usage is to import the crate in the project which is using saphir, implement validators as per the validator crate documentation, and add the saphir feature flag validate-requests to cause saphir's macro generation to generate validation code using the Validator trait. This flag is an optional flag not included in the full flag.

    The feature flag by default enable validation on all Json/Form request parameters. This will trigger compile error if any request payload is added without proper validation. A new macro attribute was added, #[validator(...), which for now allow to exclude validation on specific parameter by using the parameter name. For example:

    #[post("/")]
    #[validator(excude(req))]
    async fn my_route(&self, req: Json<RoutePayload>) -> Result<(), MyError> {
       //...
    }
    

    The exclude attribute take a comma-separated list of parameter names to be excluded.

    @LucFauvel please review this.

    opened by Samuel-B-D 1
  • Update serde_yaml requirement from 0.8.15 to 0.9.1

    Update serde_yaml requirement from 0.8.15 to 0.9.1

    Updates the requirements on serde_yaml to permit the latest version.

    Release notes

    Sourced from serde_yaml's releases.

    0.9.1

    • Fix panic on some documents containing syntax error (#293)
    • Improve error messages that used to contain duplicative line/column information (#294)
    Commits
    • 9eca262 Release 0.9.1
    • 1d7fc6b Merge pull request #295 from dtolnay/scan
    • d237020 Improve error message on scan error
    • 37bd40a Add test of scan error
    • 2c18321 Fix unreachable code panic on scan error
    • 492ac30 Merge pull request #294 from dtolnay/context
    • 4f88bf4 Eliminate repetitive line/column context from error message
    • 4167a95 Release 0.9.0
    • f2ef142 Update readme to cover enums
    • 040f0a0 Merge pull request #291 from dtolnay/tovec
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Update uuid requirement from 0.8 to 1.1

    Update uuid requirement from 0.8 to 1.1

    Updates the requirements on uuid to permit the latest version.

    Release notes

    Sourced from uuid's releases.

    1.1.0

    What's Changed

    New Contributors

    Full Changelog: https://github.com/uuid-rs/uuid/compare/1.0.0...1.1.0

    Commits
    • 99977bb Merge pull request #602 from uuid-rs/cargo/1.1.0
    • e7b58f4 prepare for 1.1.0 release
    • 7d037f5 Merge pull request #599 from dfaust/to_bytes_le
    • 7a2d4e4 Merge pull request #600 from Razican/doc_fix
    • d988df2 Fixed documentation link
    • b0ca5a0 add bytes_le roundtrip test
    • 9810dc8 add to_bytes_le method
    • e0f0837 Merge pull request #597 from uuid-rs/KodrAus-patch-1
    • 1a54a9f note that the Error display impl is public API
    • 9e0dc29 Merge pull request #596 from KodrAus/cargo/1.0.0
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Update uuid requirement from 0.8 to 1.0

    Update uuid requirement from 0.8 to 1.0

    Updates the requirements on uuid to permit the latest version.

    Release notes

    Sourced from uuid's releases.

    1.0.0

    This release includes a huge amount of work from a lot of contributors. These notes are duplicated from 1.0.0-alpha.1 since they're relevant for anybody moving from 0.8.2 to 1.0.0.

    Changes since the last release

    https://github.com/uuid-rs/uuid/compare/0.8.2...main

    Contributions since the last release

    ... (truncated)

    Commits
    • 9e0dc29 Merge pull request #596 from KodrAus/cargo/1.0.0
    • 286134f prepare for 1.0.0 release
    • 43905eb Merge pull request #595 from spruceid/remove-and
    • 444ef96 Remove unnecessary AND
    • 5f649d7 Merge pull request #592 from uuid-rs/KodrAus-patch-1
    • 92ad25f update contact details in the CoC
    • 767f519 Merge pull request #591 from uuid-rs/fix/macro-diagnostics
    • 8b043af use the parsed literal as the span source for errors
    • f0d5956 Merge pull request #587 from uuid-rs/feat/fast-sha1
    • 165b7eb move to sha1_smol as the new name for the current library
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Update rustls-pemfile requirement from 0.2 to 1.0

    Update rustls-pemfile requirement from 0.2 to 1.0

    Updates the requirements on rustls-pemfile to permit the latest version.

    Commits
    • e4559fe Prepare stable 1.0.0 release
    • e5410e3 Add additional test for EC keys of both formats
    • 9471c1e Prepare 0.3.0
    • e8e0b86 cargo fmt
    • c204f5c Fix & extend tests to cover sec1 ec keys
    • 9a7e4a8 Future-proof the Item by marking it non-exhaustive
    • f6760a2 Add Sec1 EC key support
    • 109b643 Prepare 0.2.1
    • f68646c Merge pull request #2 from zz85/optimizations
    • ae1c51e Merge pull request #1 from zz85/bench
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • [Question] - Websocket upgrade

    [Question] - Websocket upgrade

    Hello, @richerarc

    I would like to know, if I can upgrade the Http request to websocket? Also, I would like to know if the framework could work with pool of threads to handle those connections ? And, I’m new in rust, so if there is any example how to handle the questions above, I would appreciated Thanks you so much

    opened by Menniti 0
  • [FEATURE] Performance: handler pointers collection on server

    [FEATURE] Performance: handler pointers collection on server

    Description of the feature To improve performance, instead of using dynamic dispatch at runtime, in Server::build we could create a fixed list pointers to all registered handlers, which could be iterated through without having to use any dyn_handle.

    Is your feature request related to a problem? Not related to a problem, just a performance improvement

    opened by Samuel-B-D 1
  • [FEATURE] casing for route parameters

    [FEATURE] casing for route parameters

    route positional paameters name are arbitrarly, so they could be changed to a prefered casing for the api generation. For example, changing them to camelCase so that when you generate a typescript API for it with ng-openapi-gen, you would have parameters name in the same casing as the rest of your codebase.

    opened by Samuel-B-D 0
Releases(v2.8.2)
  • v2.8.2(Feb 24, 2021)

  • v2.8.1(Jan 12, 2021)

    • [FIXED] Missing Send requirements for graceful shutdown
    • [FIXED] Incorrect use statement from Syn crate
    • [NEW] ServerBuilder can new be used to write stack without starting a listener
    Source code(tar.gz)
    Source code(zip)
  • v2.8.0(Jan 12, 2021)

    • [UPDATE] base64 from 0.12 to 0.13
    • [UPDATE] cargo_metadata from 0.11.1 to 0.12 (saphir_cli)
    • [FIXED] Anonymous type array for openApiGen
    • [NEW] FileMiddleware index configuration
    • [NEW] Graceful shutdown feature
    Source code(tar.gz)
    Source code(zip)
  • v2.7.6(Sep 18, 2020)

  • v2.7.4(Sep 14, 2020)

    • [FIXED] Request could be dropped without generating a proper response on timeout
    • [FIXED] When returning a saphirError, Responder is called in all cases, allowing saphir to always respond to its caller.
    Source code(tar.gz)
    Source code(zip)
  • v2.7.3(Aug 13, 2020)

  • v2.7.2(Aug 13, 2020)

  • 2.7.1(Jul 13, 2020)

  • v2.7.0(Jul 10, 2020)

    • [NEW] Added HandlerMetadata struct to HttpContext, for now it only contains the Handler name and the route id, but in the near future will serve the purpose for custom attributes.
    • [NEW] Route are now resolved ahead of the middleware stack, this prevent useless processing if a route / method handler does not exists
    • [FIXED] Endpoint Resolver are now sorted so that the endpoint resolution is deterministic and consistant between builds / runs
    • [FIXED] Added panics when two handler overlap with the same route and uses overlapping methods
    • [UPDATE] Rustls & Tokio-Rustls are now up to date with the latest released version
    Source code(tar.gz)
    Source code(zip)
Owner
Richer Archambault
Richer Archambault
Host These Things Please - a basic http server for hosting a folder fast and simply

http Host These Things Please - a basic HTTP server for hosting a folder fast and simply Selected features See the manpage for full list. Symlinks fol

thecoshman 367 Dec 23, 2022
Simple http server in Rust (Windows/Mac/Linux)

How it looks like? Screenshot Command Line Arguments Simple HTTP(s) Server 0.6.1 USAGE: simple-http-server [FLAGS] [OPTIONS] [--] [root] FLAGS:

LinFeng Qian 788 Dec 28, 2022
Low level HTTP server library in Rust

tiny-http Documentation Tiny but strong HTTP server in Rust. Its main objectives are to be 100% compliant with the HTTP standard and to provide an eas

null 785 Dec 29, 2022
Akasio is a simple HTTP server that redirects traffic based on a JSON redirect table. This is its Rust implementation.

This page is inaccurate and is pending updates. Akasio (Rust) Description Akasio is a simple HTTP server that redirects traffic based on a JSON redire

K4YT3X 5 May 2, 2022
RUSTENGINE is the high-assurance HTTP server.

RUSTENGINE Table of Contents RUSTENGINE Table of Contents About RUSTENGINE Inspiration with Rust Features Compares with Nginx Build & Run About this R

FUNNY SYSTEMS 10 Aug 27, 2021
OxHTTP is a very simple synchronous HTTP client and server

OxHTTP is a very simple synchronous implementation of HTTP 1.1 in Rust. It provides both a client and a server.

Oxigraph 13 Nov 29, 2022
A synchronous HTTP server built on hyper.

Astra Astra is a synchronous HTTP server built on top of hyper. use astra::{Body, Response, Server}; fn main() { Server::bind("localhost:3000")

Ibraheem Ahmed 23 Nov 27, 2022
Operator is a web server. You provide a directory and Operator serves it over HTTP.

Operator Operator is a web server. You provide a directory and Operator serves it over HTTP. It serves static files the way you'd expect, but it can a

Matt Kantor 6 Jun 6, 2022
Completely OBSOLETE Rust HTTP library (server and client)

OBSOLETION NOTICE This library is DEAD. It was a useful experiment and is now being replaced under the scope of the Teepee (experimentation grounds at

Chris Morgan 390 Dec 1, 2022
Archibald is my attempt at learning Rust and writing a HTTP 1.1 web server.

Archibald To be a butler, is to be able to maintain an even-temper, at all times. One must have exceptional personal hygiene and look sharp and profes

Daniel Cuthbert 4 Jun 20, 2022
[OUTDATED] A light HTTP framework for Rust

Rustful A light HTTP framework for Rust, with REST-like features. The main purpose of Rustful is to create a simple, modular and non-intrusive foundat

Erik Hedvall 873 Nov 12, 2022
:zap: fast http framework for rust

zap ⚡ The mission of zap is, to deliver a basic, but fast rust web server library. Documentation About This code is based on tokio's minihttp project,

Daniel Oltmanns 51 Jun 7, 2022
Live Server - Launch a local network server with live reload feature for static pages

Live Server - Launch a local network server with live reload feature for static pages

Lomirus 18 Nov 30, 2022
Static Web Server - a very small and fast production-ready web server suitable to serve static web files or assets

Static Web Server (or SWS abbreviated) is a very small and fast production-ready web server suitable to serve static web files or assets.

Jose Quintana 496 Jan 2, 2023
simple static file server written in Rust based on axum framework

static-server simple static file server written in Rust based on axum framework I'm learning Rust and axum. My thought is simple. axum has a static-fi

null 27 Jan 1, 2023
Salvo is a powerful and simplest web server framework in Rust world

Salvo is an extremely simple and powerful Rust web backend framework. Only basic Rust knowledge is required to develop backend services.

Salvo 1.2k Jan 5, 2023
🌟 For when you really just want to serve some files over HTTP right now!

miniserve - a CLI tool to serve files and dirs over HTTP For when you really just want to serve some files over HTTP right now! miniserve is a small,

Sven-Hendrik Haase 4.1k Dec 31, 2022
An HTTP library for Rust

hyper A fast and correct HTTP implementation for Rust. HTTP/1 and HTTP/2 Asynchronous design Leading in performance Tested and correct Extensive produ

null 11k Jan 7, 2023
Add Facebook and Google authentication to your HTTP REST API in Actix-web

I created this project while learning Rust. Project shows how to handle Facebook and Google token verification in Rust using Actix-Web. Hope this help

null 37 Dec 31, 2022