Extremely simple http rust servers :snowboarder:

Overview

Snowboard πŸ‚

License GitHub issues Build status

An extremelly simple library for fast & simple TCP servers in rust

[Request a feature/Report a bug]

Quick start

To get started with Snowboard, simply add it to your Cargo.toml file:

[dependencies]
snowboard = "*"

Then, create a new Rust file with the following code:

use snowboard::{response, Server};

fn main() {
    let data = "Hello, world!";

    Server::new("localhost:8080").run(move |request| {
        println!("{:?}", request);

        response!(ok, data)
    })
}

And that's it! You got yourself a working server on :8080. Examples can be found here.

Async routes

You can use the async feature to change Server::run() so that it supports asynchronous handlers:

# Cargo.toml

[dependencies]
snowboard = { version = "*", features = ["async"] }
// src/main.rs

use snowboard::async_std::task;
use snowboard::{response, Request, Response, Server};
use std::time::Duration;

async fn index(req: Request) -> Response {
    println!("{:?}", req);
    // Wait 1 second before sending the response
    task::sleep(Duration::from_secs(1)).await;
    response!(ok, "Async works!")
}

fn main() {
    Server::new("localhost:8080").run(index);
}

Routing

Routing can be handled easily using the Url struct as seen in examples/routing.

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.

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

You might also like...
⚑ An extremely fast reimplementation of gmad.exe and gmpublish.exe

⚑ fastgmad Download An extremely fast reimplementation of gmad.exe and gmpublish.exe. Prefer to use a GUI? Check out gmpublisher! Features Up to x100

Python wrapper for Rust's httparse HTTP parser

httparse Python wrapper for Rust's httparse. See this project on GitHub. Example from httparse import RequestParser parser = RequestParser() buff =

πŸŽ„ My Advent of Code solutions in Rust. http://adventofcode.com/2022

Advent of Code 2022 in Rust My Advent of Code 2022 solutions in the Rust programming language. This repository holds a separate Rust project for each

⚑ Blazing fast async/await HTTP client for Python written on Rust using reqwests

Reqsnaked Reqsnaked is a blazing fast async/await HTTP client for Python written on Rust using reqwests. Works 15% faster than aiohttp on average RAII

A fast and lightweight HTTP server implementation in Rust.

server_nano A tiny, fast, and friendly web server written in rust and inspired by express. It uses may to coroutines Usage First, add this to your Car

Fork of the Official Python3 API connector for Bybit's HTTP (bybit) and WebSockets APIs to rust

Fork of pybit python libary in Rust For the rust lovers and creators for bybit exchange version 5 Official Python3 API connector for Bybit's HTTP and

HTTP client/libcurl TUI front end in Rust, with request + key storage
HTTP client/libcurl TUI front end in Rust, with request + key storage

Rust TUI HTTP Client with API Key Management This project is still in active development and although it is useable, there may still be bugs and signi

 miniserve - a CLI tool to serve files and dirs over HTTP
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!

A lightweight but incredibly powerful and feature-rich BitTorrent tracker. Supports UDP + HTTP(S) and a private tracker mode.

Torrust Tracker Project Description Torrust Tracker is a lightweight but incredibly powerful and feature-rich BitTorrent tracker made using Rust. Feat

Releases(v0.4.2)
An extremely fast glob matching library in Rust.

glob-match An extremely fast glob matching library with support for wildcards, character classes, and brace expansion. Linear time matching. No expone

Devon Govett 247 Jan 27, 2023
An extremely high performance logging system for clients (iOS, Android, Desktop), written in Rust.

Pinenut Log δΈ­ζ–‡ζ–‡ζ‘£ ・ English An extremely high performance logging system for clients (iOS, Android, Desktop), written in Rust. Overview Compression Pin

Tangent 4 Dec 1, 2023
Download pdbs from symbol servers and cache locally, parse symbol paths from env vars

symsrv This crate lets you download and cache pdb files from symbol servers, according to the rules from the _NT_SYMBOL_PATH environment variable. It

Markus Stange 6 Sep 15, 2022
A versatile and dynamic music bot designed to elevate the musical experience within Discord servers.

Masayoshi Masayoshi is a discord music bot written in Rust for making a great experience within Discord servers with support to Youtube, SoundCloud, S

null 6 Dec 26, 2023
A CLI app to set and organize your favorite DNS servers.

rdns A CLI app to set and organize your favorite DNS servers. Introduction rdns is a CLI utility that can set your system DNS, either directly or by m

null 4 Feb 19, 2024
A fully modular window manager, extremely extensibile and easily approachable.

AquariWM is a fully modular window manager, allowing extreme extensibility while remaining easily approachable. Installation AquariWM is currently in

AquariWM Window Manager 8 Nov 14, 2022
⚑ An extremely fast cross-compatible system information tool.

Lightfetch A extremely fast command-line system information tool written in Rust ⚑ . Gallery Sadly there isn't much to showcase right now. Download Av

bwtecode 2 Sep 12, 2022
⚑ An extremely fast cross-compatible system information tool.

Lightfetch A extremely fast command-line system information tool written in Rust ⚑ . Gallery Sadly there isn't much to showcase right now. Download Av

bwtecode 2 Sep 12, 2022
RedMaple offers an oppinionated yet extremely flexible data modeling system based on events for back-end applications.

RedMaple offers an oppinionated yet extremely flexible data modeling system based on events for back-end applications.

Amir Alesheikh 4 Mar 5, 2023
Maccha is an extremely extensible and themable power menu for Windows, macOS, and Linux.

Maccha I hate coffee. Maccha is an extremely extensible and themable power menu for Windows, macOS, and Linux. Plugins Plugins are written in Rust (ot

Kyza 9 May 13, 2023