#web-server #routes #standard #go #pattern #requests #request

rustigo

A Rust webserver inspired by the Go standard library's HTTPServer

3 stable releases

1.1.3 Mar 28, 2024
1.1.1 Dec 10, 2023

#327 in HTTP server

Download history 15/week @ 2024-02-22 23/week @ 2024-02-29 56/week @ 2024-03-07 6/week @ 2024-03-14 156/week @ 2024-03-28 10/week @ 2024-04-04

166 downloads per month

MIT license

14KB
310 lines

Rustigo

A Rust webserver inspired by the Go standard library's HTTPServer

Features:

  • Lightweight
  • Pattern matched routes
  • No dependencies

Example

use rustigo::prelude::*;

fn index(stream: TcpStream, _: Request) {
    html!(stream; "<h1>Hello, world!</h1>");
}

fn main() {
    let mut rustigo = Rustigo::default();

    rustigo.handle("/", Arc::new(index));

    rustigo.listen("localhost:7878", 4).unwrap();
}

lib.rs:

Rustigo is a simple web server that allows you to handle requests with ease.

Example usage:

use rustigo::prelude::*;

fn index(stream: TcpStream, _: Request) {
    html!(stream; "<h1>Hello, world!</h1>");
}

fn main() {
    let mut rustigo = Rustigo::default();

    rustigo.handle("/", Arc::new(index));

    rustigo.listen("localhost:7878", 4).unwrap();
}

No runtime deps