21 releases (12 breaking)

new 0.13.0 Dec 25, 2024
0.11.0 Dec 1, 2024
0.10.0 Oct 4, 2024
0.7.1 Feb 2, 2024
0.1.0 Oct 10, 2023

#152 in HTTP server

Download history 12/week @ 2024-09-07 62/week @ 2024-09-14 206/week @ 2024-09-21 156/week @ 2024-09-28 51/week @ 2024-10-05 9/week @ 2024-10-12 192/week @ 2024-11-30 385/week @ 2024-12-07 126/week @ 2024-12-14 150/week @ 2024-12-21

853 downloads per month

MIT license

2MB
4K SLoC

rupring

GitHub license

Spring Comes to Rust

Get Started

required dependency list

rupring = "0.13.0"
serde = { version="1.0.193", features=["derive"] }

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)
}

fn main() {
    rupring::run(RootModule {})
}

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

More Details

Please refer to the documentation for more details.

Dependencies

~7–17MB
~243K SLoC