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

#2326 in Web programming

Download history 46/week @ 2023-10-28 37/week @ 2023-11-04 23/week @ 2023-11-11 34/week @ 2023-11-18 42/week @ 2023-11-25 46/week @ 2023-12-02 24/week @ 2023-12-09 39/week @ 2023-12-16 46/week @ 2023-12-23 22/week @ 2023-12-30 34/week @ 2024-01-06 31/week @ 2024-01-13 36/week @ 2024-01-20 41/week @ 2024-01-27 13/week @ 2024-02-03 56/week @ 2024-02-10

150 downloads per month

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
~260K SLoC