Rusty_Express

Rusty<em>Express on crates.io Rusty</em>Express on docs.rs

What is this

This is a simple http server library written in Rust and provide Express-alike APIs. We know Rust is hard and daunting to use, so the goal of this project is to make sure your server can be easy to use without fears.

Many of today's popular Rust-based web framework are very verbose and difficult to use, one will usually have to learn advanced Rust features or API libraries in order to finish a seemingly easy job in other language's framework. So we started this project to make it easy to use Rust as a back-end technology, and aims to provide native experience similar to Node's Express framework. That's how this project got its name of "Rusty Express": a Rust based, Express-alike web framework.

Version 0.3.0+ is a major milestone, from this point on the APIs shall be mostly stable, and we expect to make less, if none, break changes, but please do let us know if you've come across bugs that we should fix, or have met performance bottle necks that we shall try to improve.

What's new in 0.3.1

Migrating from 0.2.x to 0.3.0

0.2.x versions are good experiments with this project. But we're growing fast with better features and more performance enhancement! That's why we need to start the 0.3.x versions with slight changes to the interface APIs.

Here're what to expect when updating from 0.2.x to 0.3.0:

How to use

In your project's Cargo.toml, add dependency: cargo [dependencies] rusty_express = "^0.3.0" ...

In src\main.rs: ```rust extern crate rusty_express;

use rusty_express::prelude::*;

fn main() { //A http server with default thread pool size of 4 let mut server = HttpServer::new();

//Change thread pool size from 8 (default) to 10.
server.set_pool_size(10);

//Route definition
server.get(RequestPath::Exact("/"), handler);

//Listen to port 8080, server has started.
server.listen(8080);

}

pub fn handler(req: &Box, resp: &mut Box) { resp.send("Hello world from the rusty-express server!\n"); resp.status(200); } ```

Examples