9 releases (breaking)

0.7.1 Feb 2, 2024
0.7.0 Feb 2, 2024
0.6.0 Dec 27, 2023
0.5.1 Dec 21, 2023
0.1.0 Oct 10, 2023

#336 in HTTP server

Download history 11/week @ 2023-12-18 3/week @ 2023-12-25 9/week @ 2024-01-29 2/week @ 2024-02-19 2/week @ 2024-02-26 108/week @ 2024-03-04 24/week @ 2024-03-11 45/week @ 2024-04-01

75 downloads per month

MIT license

2MB
2K SLoC

rupring

GitHub license

spring on rust

Get Started

There is only one dependency.

cargo add rupring

And you can write your server like this:

#[derive(Debug, Clone, Copy)]
#[rupring::Module(controllers=[HomeController{}], modules=[])]
pub struct RootModule {}

#[derive(Debug, Clone)]
#[rupring::Controller(prefix=/, routes=[hello, echo])]
pub struct HomeController {}

#[rupring::Get(path = /)]
pub fn hello(_request: rupring::Request) -> rupring::Response {
    rupring::Response::new().text("Hello, World!".to_string())
}

#[rupring::Get(path = /echo)]
pub fn echo(request: rupring::Request) -> rupring::Response {
    rupring::Response::new().text(request.body)
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
    let app = rupring::RupringFactory::create(RootModule {});

    app.listen(3000).await?;

    Ok(())
}

And if you run the program, it will work fine.
Alt text

More Details

Please refer to the documentation for more details.

Dependencies

~7–19MB
~223K SLoC