Rust的Web框架:nickel.rs
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 = "*"
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!