GitXplorerGitXplorer
R

nickel-mustache

public
2 stars
4 forks
4 issues

Commits

List of commits on branch master.
Unverified
ee39001b1a5e9af1e8fbc3481cc8390ea94509af

chore(doc): add links for documentation

RRyman committed 9 years ago
Unverified
24e33a3f4ffb0af9876cb693e4639aaba55b61c9

chore(ci): add travis

RRyman committed 9 years ago
Unverified
777bc60c93af284d8fcdc223c19f0f7c40bd5c79

chore(cargo): add some more package metadata

RRyman committed 9 years ago
Unverified
5b24b90fb14ef4c55497ccd7e68c6ad61761f692

chore(*): add LICENSE

RRyman committed 9 years ago
Unverified
b1f4cd622f4ee469bbd803ff60077521ceff5e2a

docs(*): add light documentation

RRyman committed 9 years ago
Unverified
ae99f57981cdf454be6e74bc90eec3ce20e7ab85

docs(readme): add Readme

RRyman committed 9 years ago

README

The README file for this repository.

nickel_mustache

Flexible Mustache support for nickel.rs using rust-mustache.

#[macro_use] extern crate nickel;
extern crate nickel_mustache;
extern crate rustc_serialize;

use nickel_mustache::Render;
use nickel::{Nickel, HttpRouter};

fn main() {
    let mut server = Nickel::new();

    server.get("/*", middleware! { |_req, res|
        #[derive(RustcEncodable)]
        struct ViewData<'a> {
            name: &'a str
        }

        let data = ViewData { name: "World" };

        return Render::render(res, "examples/assets/my_template", &data)
    });

    server.listen("127.0.0.1:6767");
}

Core Features

  • Layout support
  • Centralized path adjustments
  • Optional template compilation caching

Dependencies

You'll need to create a Cargo.toml that looks like this;

[package]

name = "my-nickel-app"
version = "0.0.1"
authors = ["yourname"]

[dependencies]
nickel_mustache = "*"
nickel = "*"
# Some examples require the `rustc_serialize` crate, which will
# require uncommenting the lines below
# rustc-serialize = "*"

You can then compile this using Cargo build and run it using Cargo run. After it's running you should visit http://localhost:6767 to see your hello world! (Note: the examples run with randomized ports, so please check the console output for the active port)

More examples

More examples can be found in the examples directory, please check them out and you are welcome to log an issue if you have any trouble!

Generated documentation can be found here