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

TechMagister/iron-liquid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iron-liquid

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

Use liquid : https://github.com/FerarDuanSednan/liquid-rust.git

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

#Example

use liquid::Value;
use std::default::Default;

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

    let data : HashMap<String, Value> = 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 = LiquidEngine::new("./examples", Default::default());

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

About

Bring liquid template to Iron

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages