Skip to content

levidyrek/rust_http_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Static HTTP 1.0 Server

This is a static HTTP 1.0 server written in Rust. It supports GET requests for static documents (e.g. HTML, CSS, images, plain text) that exist in the document root on the server.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Install Rust and Cargo

Development Setup

Clone this repository.

git clone [email protected]:levidyrek/rust_http_server.git

Create the document root. By default, this is at /static/, but can be set to a custom directory with the STATIC_ROOT environment variable.

mkdir /static/

or

export STATIC_ROOT="/custom_dir"
mkdir /custom_dir

Run the server in debug mode.

cargo run

Deployment

Clone this repository.

git clone [email protected]:levidyrek/rust_http_server.git

Create the document root. By default, this is at /static/, but can be set to a custom directory with the STATIC_ROOT environment variable.

mkdir /static/

or

export STATIC_ROOT="/custom_dir"
mkdir /custom_dir

Build the package.

cargo build --release

Run the server.

./target/release/rust_http_server

Usage

Place documents or images in the document root at /static/, or a in custom directory specified by the STATIC_ROOT environment variable.

Make an HTTP 1.0 request at the port 8001 to retrieve your documents.

$ curl -0 localhost:8001/index.html
<h1>Success!</h1>

Built With

  • Rust - The language used

Acknowledgments

About

A static HTTP 1.0 server built with Rust.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages