aboutsummaryrefslogtreecommitdiffstats
path: root/examples/server.rs
blob: 864c105c3c5004681262eae2d4a1224d9012cb76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
extern crate conduit;
extern crate http;
extern crate fastcgi_conduit;

use std::fs::OpenOptions;
use std::io::prelude::*;
use std::io;

use conduit::{Body, RequestExt, Response};
use conduit::header;

use fastcgi_conduit::Server;


fn main() {
    Server::start(handler);
}

fn handler(req: &mut dyn RequestExt) -> io::Result<Response<Body>> {
    Ok(
        Response::builder()
            .header(header::CONTENT_TYPE, "text/html")
            .body(Body::from_static(b"<h1>Test</h1>"))
            .unwrap()
    )
}