Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/steveklabnik/simple-server

A simple webserver built on top of the Rust standard library and the http crate.
https://github.com/steveklabnik/simple-server

rust web webserver

Last synced: 9 days ago
JSON representation

A simple webserver built on top of the Rust standard library and the http crate.

Awesome Lists containing this project

README

        

# simple-server

> a crate for building a simple blocking HTTP server

[![Build Status](https://travis-ci.org/steveklabnik/simple-server.svg?branch=master)](https://travis-ci.org/steveklabnik/simple-server)
[![crates.io](https://img.shields.io/crates/v/simple-server.svg)](https://crates.io/crates/simple-server)

**NOTE**: this crate has not been evaluated for security concerns. therefore, we recommend
that you take caution before using it in a production application.

## up and running

this crate is written in [the rust programming language]. you'll need rust to run
this crate. you can install rust using [rustup]. `simple-server` requires that you
use **rust version 1.20+**.

to get this crate running locally:

1. fork and clone this repository
2. `cd simple-server`
3. `cargo build`

to use this crate in your project, add the following line to your `Cargo.toml`
in the `[dependencies]` section:

```toml
simple-server = "0.3.0"
```

to see this crate in action, check out the [examples].

[the rust programming language]: https://www.rust-lang.org
[rustup]: https://www.rustup.rs/
[examples]: #examples

## tests

to test this crate locally, run:

```bash
cargo test
```

## docs

this crate has documentation. to build and open the docs locally:

```bash
cargo doc --open
```

## examples

there are several examples provided with this crate:

- [server](https://github.com/steveklabnik/simple-server/blob/master/examples/server.rs)
- [routes](https://github.com/steveklabnik/simple-server/blob/master/examples/routes.rs)

to run an example:

```bash
cargo run --example
```

this crate uses the [log] crate for logging. in the example, we use the
[env-logger] crate to display the logs. by default, [env-logger] only
prints out error-level logs. to enable info-level logging as well, you'll
need to do one of the following depending on your system:

on Linux/OS X:

```bash
RUST_LOG="simple_server=info" cargo run --example server
```

on Windows PowerShell:

```ps
$env:RUST_LOG="simple_server=info";
cargo run --example server
```

[log]: https://crates.io/crates/log
[env-logger]: https://crates.io/crates/env-logger

## license

`simple-server` is licensed under both the Apache2 and MIT licenses.