7 releases (breaking)
0.7.0 | Sep 22, 2024 |
---|---|
0.6.0 | Sep 20, 2024 |
0.5.0 | Sep 16, 2024 |
0.4.0 | Sep 15, 2024 |
0.1.0 | Sep 12, 2024 |
#1171 in Web programming
431 downloads per month
115KB
2.5K
SLoC
vintage
Let's take it back to the 1990s. This library implements a multi-threaded server that speaks the FastCGI protocol.
Try it out!
Browsers don't speak FastCGI protocol. Thankfully, most popular web servers do. I'll be using Nginx & Caddy as examples.
- Download either Nginx or Caddy
- Configure the web server to reverse proxy fastcgi:
-
If you picked caddy, stick this in a file in the current directory called
Caddyfile
:localhost { reverse_proxy localhost:8000 { transport fastcgi } }
-
If you picked nginx, stick this in a file in the current directory called
nginx.conf
:events { } http { server { location / { fastcgi_pass localhost:8000; } } }
-
- Run the web server
- Caddy:
sudo caddy run --config Caddyfile
- Nginx:
sudo nginx -p $(pwd) -c nginx.conf
- Caddy:
- Run
cargo new --bin app && cd app && cargo add vintage
, and stick this inmain.rs
:use vintage::{ServerConfig, Response}; fn main() { let config = ServerConfig::new() .on_get(["/about"], |_req, _params| { Response::html("<h1>Hello World</h1>") }); let server = vintage::start(config, "localhost:8080").unwrap(); server.join(); }
- Run
cargo run
- Visit
http://localhost
on your browser!
Similar libraries
Dependencies
~4–11MB
~98K SLoC