8 releases

Uses old Rust 2015

0.1.7 Apr 26, 2018
0.1.6 Apr 25, 2018

#41 in #http2

25 downloads per month

MIT license

42KB
1K SLoC

Rust 1K SLoC // 0.1% comments Shell 108 SLoC // 0.0% comments

httimple.rs Build Status Version Downloads

Simple HTTP 2.0 library for building APIs

Introduction

Httiple aims to make HTTP/2 over TLS in rust simple. It adopts a Express-like interface.

Implemented

  • A basic implementation of the h2 standard.
  • A per stream state based handler.
  • Different methods

Working on

  • Making the implementation of HTTP/2 work in all browsers (currently only working in chrome)
  • Fix TLS errors (Don't know if this is my fault of rustls)
  • Implement the missing frametypes.
  • Add support for priority.
  • Make the callback a future.
  • Implement a propper hpack lib in rust (the one used currently seems a bit broken)
  • Serving static files (started, but currently impossible to make multiple requests)

Get started

1. Install Rust.
2. Create the project.
cargo new myserver 
3. Add required files.

Add an index.html and a certificate in the main folder. Name the certificate folder "ca".

4. Add depencies

Add this to your Cargo.toml

[dependencies]
httimple = "*"
5. Write the code

Make a file containing this and name it main.rs.

extern crate httimple;

use httimple::app::App;

use httimple::app::message::Message;
use httimple::app::call::Call;

use httimple::helpers::file;


fn main() {
    let mut app = App::new();
    app.serve("/", | call: &Call | -> Message {
        Message::from(file("index.html"))
    });
    app.start();
}
6. Run the code
cargo run --release

Dependencies

~10MB
~288K SLoC