this post was submitted on 28 Dec 2023
40 points (97.6% liked)

Rust

6049 readers
42 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

[email protected]

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
 

who?

Hello! I'm VΓ­ctor (aka Brian3647), a 15-year- old self-taught spanish developer. I love rust & cats, and I hate JS. I've been working on this project for ~2.5 months now:

what?

Snowboard (https://github.com/Brian3647/snowboard) is a library written in rust made for creating http/https servers easily. It supports json*, websockets*, TLS*, async*, http request parsing & response generation. *: enabled by feature

why?

Some developers like me prefer a simple API that can be freely extended for your app over a big system of complex proc macros where you have no idea what or how is happening. Snowboard offers a simplistic API that gives freedom of use to the developer without any complication or headache. You code your server just like you want it to be.

should I use snowboard?

Give it a try! From what I've seen, some people like a lot this way of coding servers, whereas other people can't live without #[get("/")]. Use it or not, giving a star to the project is always appreciated :)

example program (as of 1.0.3):

use snowboard::{headers, response, Method, Result, Server};

fn main() -> Result {
    let server = Server::new("localhost:8080")?;

    println!("Listening on {}", server.pretty_addr()?);

    server.run(|req| {
        if req.method == Method::DELETE {
            return response!(method_not_allowed, "Caught you trying to delete!");
        }

        response!(ok, "Hello!", headers! { "X-Hello" => "World!" })
    })
}
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 4 points 11 months ago (1 children)

Nice job! I'll have to try this out on my Pi 5.

[–] vicmdv 3 points 11 months ago

Ty! I haven't tested on raspberry pi, so make sure to tell me if anything isn't working as expected