#web-server #tcp-stream #routes #go #pattern #standard #matched

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

#463 in HTTP server

Download history 6/week @ 2024-09-18 16/week @ 2024-09-25 15/week @ 2024-10-02

129 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