Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (36 sloc) 1.01 KB
extern crate gotham;
extern crate gotham_derive;
extern crate hyper;
extern crate serde;
extern crate serde_derive;
use gotham::helpers::http::response;
use gotham::router::builder::*;
use gotham::state::*;
use hyper::{Body, Response, StatusCode};
fn main() {
let addr = "";
println!("Listening for requests at http://{}", addr);
let router = build_simple_router(|route| {
gotham::start(addr, router)
fn say_ok(state: State) -> (State, Response<Body>) {
let res = response::create_empty_response(&state, StatusCode::OK);
(state, res)
#[derive(Deserialize, StateData, StaticResponseExtender)]
struct PathExtractor {
id: String,
fn log_user(mut state: State) -> (State, String) {
let id = PathExtractor::take_from(&mut state).id;
(state, id)
You can’t perform that action at this time.