Module hyper::server [] [src]

HTTP Server

Example

use hyper::server::{Server, Request, Response};
use hyper::status::StatusCode;
use hyper::uri::RequestUri;

let server = Server::http(|req: Request, mut res: Response| {
    *res.status_mut() = match (req.method, req.uri) {
        (hyper::Get, RequestUri::AbsolutePath(ref path)) if path == "/"  => {
            StatusCode::Ok
        },
        (hyper::Get, _) => StatusCode::NotFound,
        _ => StatusCode::MethodNotAllowed
    };
}).listen("0.0.0.0:8080").unwrap();

Reexports

pub use self::request::Request;
pub use self::response::Response;
pub use net::{Fresh, Streaming};

Modules

request

Server Requests

response

Server Responses

Structs

Listening

A listening server, which can later be closed.

Server

A server can listen on a TCP socket.

Traits

Handler

A handler that can handle incoming requests for a server.