Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

TechMagister/iron-mustache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iron-mustache

Bring mustache template to Iron : https://github.com/iron/iron

Use rustache : https://github.com/FerarDuanSednan/rustache.git

Inspired by https://github.com/sunng87/handlebars-iron.git

Use this at your own risk.

#Example

/// the handler
fn hello_world(_req: &mut Request) -> IronResult<Response> {
    let mut resp = Response::new();

    // open http://localhost:3000/
    let data :BTreeMap<String, Json> = make_data();
    resp.set_mut(Template::new("index", data)).set_mut(status::Ok);
    Ok(resp)
}

fn main() {
    env_logger::init().unwrap();

    let mut chain = Chain::new(hello_world);
    let muse = MustacheEngine::new("./examples");

    chain.link_after(muse);
    println!("Server running at http://localhost:3000/");
    Iron::new(chain).http("localhost:3000").unwrap();
}

About

Bring mustache template to Iron

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages