2 releases
Uses old Rust 2015
0.4.4 | May 17, 2018 |
---|---|
0.4.3 | May 16, 2018 |
#971 in HTTP server
225KB
2.5K
SLoC
#chilli (A Sharp Pencil fork)
A microframework for Rust inspired by Flask.
extern crate chilli;
use chilli::{Pencil, Request, Response, PencilResult};
fn hello(_: &mut Request) -> PencilResult {
Ok(Response::from("Hello World!"))
}
fn main() {
let mut app = Pencil::new("/web/hello");
app.get("/", "hello", hello);
app.run("127.0.0.1:5000");
}
One simple guide: https://github.com/golddranks/sharp_pencil https://fengsp.github.io/blog/2016/3/introducing-pencil/
If you feel anything wrong, feedbacks or pull requests are welcome.
lib.rs
:
Pencil is a microframework for Rust inspired by Flask.
Installation
This crate is called chilli
and you can depend on it via cargo:
[dependencies]
chilli = "*"
Quickstart
A short introduction to chilli.
A Minimal Application
A minimal chilli application looks something like this:
extern crate chilli;
use chilli::Pencil;
use chilli::{Request, PencilResult, Response};
use chilli::method::Get;
fn hello(_: &mut Request) -> PencilResult {
Ok(Response::from("Hello World!"))
}
fn main() {
let mut app = Pencil::new("/web/hello");
app.route("/", &[Get], "hello", hello);
app.run("127.0.0.1:5000");
}
Dependencies
~16MB
~306K SLoC