/nickel.rs

An expressjs inspired web framework for Rust

Primary LanguageRustMIT LicenseMIT

nickel.rs

Build Status Join the chat at https://gitter.im/nickel-org/nickel.rs

nickel is supposed to be a simple and lightweight foundation for web applications written in Rust. It's API is inspired by the popular express framework for JavaScript.

Some of the features are:

  • Easy handlers: A handler is just a function that takes a &Request and &mut Response
  • Variables in routes. Just write my/route/:someid
  • Easy parameter access: request.param("someid")
  • simple wildcard routes: /some/*/route
  • double wildcard routes: /a/**/route
  • middleware
    • static file support

##Jump to the nickel.rs website

#Getting started The easiest way to get started is to get the example running and play around with it. Let's do that real quick!

##Clone the repository

git clone --recursive https://github.com/nickel-org/nickel.git

##Build nickel

cargo build --release

##Run the tests

cargo test

##Run the example

cargo run --example example

Then try localhost:6767/user/4711 and localhost:6767/bar

Note about nightly

To build on nightly, you will need to add --features nightly to the end of the above commands. Alternatively, if depending on the library you will need to add the following to your Cargo.toml.

[dependencies.nickel]
version = "*"
features = ["nightly"]

##Hello World! Here's a simple server, for a longer example check out the examples folder.

#[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");
}

##Jump to the Full Documentation

##License

Nickel is open source and licensed with the MIT license

##Contributing

Nickel.rs is a community effort. We welcome new contributors with open arms. There is list of open issues right here on github.

If you need a helping hand reach out to @cburgdorf, @Ryman or @SimonPersson.

Make sure to follow this commit message convention because we will auto generate a changelog with clog in the future.

And hey, did you know you can also contribute by just starring the project here on github :)