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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
//! # Overview //! Pronghorn is a Rust web framework developed with simplicity in mind. Current //! focus is on providing a solid synchronous solution. Async will be an option //! and will be given more focus when the rust async story improves. //! //! ## Example //! ``` //! extern crate pronghorn; //! //! use pronghorn::app::App; //! use pronghorn::{Context, Response}; //! //! fn root(_context: Context) -> Response { //! let mut res = Response::new(); //! res.set_body("/"); //! res //! } //! //! fn foo(_context: Context) -> Response { //! let mut res = Response::new(); //! res.set_body("/foo"); //! res //! } //! //! fn username(context: Context) -> Response { //! let username = context.params.get("username").unwrap(); //! println!("{:?}", username); //! return Response::new(); //! } //! //! //! fn main() { //! let addr = "127.0.0.1:3000".parse().unwrap(); //! let mut app = App::new(); //! app.router.get("/", root); //! app.router.get("/foo", foo); //! app.router.get("/user/{username}", username); //! app.run(&addr); //! } //! ``` extern crate regex; extern crate hyper; extern crate futures; extern crate futures_cpupool; use futures::future::FutureResult; use hyper::error::Error; pub mod app; pub mod router; pub mod context; pub type Future = FutureResult<Response, Error>; pub type Request = hyper::server::Request; pub type Response = hyper::server::Response; pub type Context = context::Context;