Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save withoutboats/bd91286a1c04f170532f1f83bd5ca513 to your computer and use it in GitHub Desktop.
Save withoutboats/bd91286a1c04f170532f1f83bd5ca513 to your computer and use it in GitHub Desktop.
#[macro_use] extern crate cargonauts;
use cargonauts::futures::{Future, future};
use cargonauts::resources::{Resource, Environment, Error};
use cargonauts::methods::Get;
use cargonauts::formats::Debug;
routes! {
resource Echo {
method Get in Debug;
}
}
#[derive(Debug)]
struct Echo(String);
impl Resource for Echo {
type Identifier = String;
}
impl Get for Echo {
fn get(id: String, _: &mut Environment) -> Box<Future<Item = Echo, Error = Error>> {
Box::new(future::ok(Echo(id)))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment