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.
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);
}