added example for multithreaded use

This commit is contained in:
Jakob Demler 2016-06-07 12:13:08 +02:00
parent 8604e88be0
commit 1fce32751e
1 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,12 @@
extern crate fastcgi;
use std::net::TcpListener;
use std::io::Write;
use std::thread;
fn main() {
fastcgi::run_tcp(|mut req| {
thread::spawn(move || write!(&mut req.stdout(), "Content-Type: text/plain\n\nHello, world!"));
}, &TcpListener::bind("127.0.0.1:8000").unwrap());
}