Snowboard 🏂
An extremely simple (& blazingly fast) library for fast HTTP & HTTPS servers in Rust
[Request a feature/Report a bug]
Quick start
To get started with Snowboard, simply add it to your Cargo.toml file:
[]
= "*"
Then, create a new Rust file with the following code:
use ;
And that's it! You got yourself a working server on :8080. Examples can be found in the examples folder.
Async routes
You can use the async feature and Server::run_async to run async routes:
# Cargo.toml
[]
= { = "*", = ["async"] }
// src/main.rs
use task;
use ;
use Duration;
async
TLS
Use the tls feature (which will also install native-tls) to use TLS:
use Result;
use ;
use fs;
You can confirm it works by running curl -k localhost:3000 (the -k is needed to allow self-signed certificates)
More info can be found in examples/tls.
Websockets
WebSockets are easy to implement with the websocket feature. Example (echo server):
use TcpStream;
use Server;
use WebSocket;
note: WebSocket<&mut TcpStream> becomes WebSocket<&mut TlsStream<TcpStream>> with the tls feature enabled (see examples/tls).
Routing
Routing can be handled easily using the Url struct as seen in examples/routing.rs.
Integration
Snowboard's ResponseLike is designed to work with pretty much anything, but it wont by default with certain cases like maud's html! macro. If you happen to use a lot a crate that doesn't work with Snowboard, please open an issue, pr or implement ResponseLike for it:
use ;
Why should I use this?
Snowboard is designed and created for people who like coding their own things from little to nothing, like me. This library does not implement what most server libraries have, like an advanced routing system, but rather offers a set of essential tools to create a powerful web server.
MSRV (Minimum Supported Rust Version)
The MSRV is 1.60.0, but it might change (lower or higher) depending on which features are enabled.
Contributing
Check CONTRIBUTING.md for a simple guide on how to help the project.
License
This code is under the MIT license that can be found at LICENSE