8 unstable releases (3 breaking)

Uses old Rust 2015

0.3.0 Oct 9, 2016
0.2.1 Jun 16, 2016
0.2.0 May 13, 2016
0.1.3 Apr 5, 2016
0.0.1 Dec 13, 2015

#9 in #micro-framework

BSD-3-Clause

225KB
2K SLoC

#Pencil

Build Status Crates.io Version Crates.io LICENSE

A microframework for Rust inspired by Flask.

extern crate pencil;

use pencil::{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://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 pencil and you can depend on it via cargo:

[dependencies]
pencil = "*"

Quickstart

A short introduction to Pencil.

A Minimal Application

A minimal Pencil application looks something like this:

extern crate pencil;

use pencil::Pencil;
use pencil::{Request, PencilResult, Response};
use pencil::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

~12MB
~249K SLoC