mudpie

Crates.iomudpie
lib.rsmudpie
version0.2.6
sourcesrc
created_at2015-01-21 21:47:53.162905
updated_at2015-12-11 23:54:29.779751
descriptionDynamic HTTP Server. Pure safe Rust, no dependencies.
homepage
repositoryhttps://github.com/kjpgit/mudpie
max_upload_size
id849
size2,800,983
Universal LMS (github:netology-group:universal-lms)

documentation

README

= Mudpie

:app: Mudpie

== Overview

{app} is a simple multi-threaded HTTP server for the amazingly awesome Rust language. It is inspired by Python's WSGI specification.

{app} is written in 100% safe Rust code (no unsafe blocks) and has no dependencies. It is intended to be reliable and easy to audit for security, especially for embedded applications.

NOTE: The {app} master branch is for Rust nightly.

== Hello World Code

[source,rust]

extern crate mudpie; use mudpie::{WebServer, WebRequest, WebResponse};

fn hello(req: &WebRequest) -> WebResponse { let page = "

Hello World!

".to_string(); return WebResponse::new_html(page); }

fn main() { let mut svr = WebServer::new(); svr.add_path("get", "/hello", hello); svr.run("127.0.0.1", 8000); }

== Running the Demo Server

Use +cargo run+ to start the included demo server, which has some example pages you can visit at +http://localhost:8000/+.


$ cargo run 0.0.0.0 8000

 Running `target/demo 0.0.0.0 8000`

listening on 0.0.0.0:8000 starting 10 worker threads starting monitor loop

You can benchmark it using a program like "boom" or any other HTTP tester:


$ ./goprograms/bin/boom -n 100000 -c 10 -cpus 3 http://localhost:8000/bench

Summary: Total: 3.2466 secs. Slowest: 0.0342 secs. Fastest: 0.0001 secs. Average: 0.0003 secs. Requests/sec: 30801.6515

NOTE: You should probably turn request logging off (export MUDPIE_LOGGING=0) or redirect it to /dev/null when benchmarking, and also use cargo run --release to enable compiler optimizations.

== More Information

== License

Public Domain.

Commit count: 211

cargo fmt