Rust的Web框架:nickel.rs

jopen 9年前

nickel是一款Rust语言的Web框架,它的灵感来自于 Javascript的流行框架express

Hello world

#[macro_use] extern crate nickel;     use nickel::Nickel;     fn main() {      let mut server = Nickel::new();         server.utilize(router! {          get "**" => |_req, _res| {              "Hello world!"          }      });         server.listen("127.0.0.1:6767");  }

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]  version = "*"  # If you are using the 'nightly' rust channel you can uncomment  # the line below to activate unstable features  # features = ["unstable"]    # Some examples require the `rustc_serialize` crate, which will  # require uncommenting the lines below  # [dependencies]  # rustc-serialize = "*"


项目主页:http://www.open-open.com/lib/view/home/1441786404555