1 个不稳定版本
使用旧的 Rust 2015
0.1.0 | 2015年4月12日 |
---|
#8 in #nickel
2KB
nickel.rs

nickel.rs 是用 Rust 编写的简单且轻量级的网络应用基础。它的 API 受 JavaScript 中流行的 express 框架的启发。
你好世界
#[macro_use] extern crate nickel;
use nickel::{Nickel, HttpRouter};
fn main() {
let mut server = Nickel::new();
server.get("**", middleware!("Hello World"));
server.listen("127.0.0.1:6767");
}
依赖项
您需要创建一个类似以下的 Cargo.toml 文件;
[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 = "*"
然后您可以使用 Cargo build 编译它,并使用 Cargo run 运行它。运行后,您应该访问 https://127.0.0.1:6767 来查看您的“你好世界”!
更多示例
贡献
nickel.rs 是社区的努力成果。我们张开双臂欢迎新的贡献者。请先阅读 贡献指南。
如果您需要灵感,这里有一个 打开的问题列表。
如果您需要帮助,请联系 @jolhoeft、@cburgdorf、@Ryman 或 @SimonPersson。
嘿,你知道吗?您也可以通过在这里的 GitHub 上为项目加星来做出贡献 :)
开发计划
版本 | 分支 | 描述 |
---|---|---|
0.11.x | maint-0.11.x | hyper-0.10.x(同步版本),仅错误修复 |
0.12.x | master | hyper-0.14.x(异步版本) |
0.13.x | 新功能,可能将成为 1.0 |