Super fast, zero configuration command line HTTP Server.
Switch branches/tags
Clone or download
tzekid and sdogruyol minor refactor; updated to crystal 0.23; added args and options (#9)
* Fixed to work with crystal version 0.21.1+; refractored the code a bit; you can choose a directory now ('-d')

* Delete fast-http-server

* Fixed to work with crystal version 0.21.1+; refactored the code a bit; you can choose a directory now ('-d')

* fixed #1; added dir_listing toggle

* upsie

* updated readme

* minor change

* Update version.cr

* Update README.md

* fixed wrong use of redirect_to
Latest commit 177fa38 Apr 15, 2018

README.md

fast-http-server

Super fast, zero configuration command line HTTP Server written in Crystal programming language.

Usage

Zero configuration: fast-http-server and your server's ready.

usage: fast-http-server [-h] [-d DIR] [port]

positional arguments:
    port                             specify alternate port [default: 3000]

optional arguments:
    -h, --help                       show this help message and exit
    -d DIR, --directory DIR          specify a directory
    -l LIST, --listdir LIST          enable/disable directory listing (yes/no)

By default fast-http-server listens port 3000. Go to localhost:3000.

To listen on a different port you can start fast-http-server with the desired port:
fast-http-server 5050

To choose a directory: fast-http-server -d example_directory

Fast

Numbers speak louder than words.

Server Request Per Second Avg. Response Time
fast-http-server (Crystal) 18348.47 8.67ms
http-server (Node.js) 2105.55 47.92ms
SimpleHTTPServer (Python) 785.14 1.91ms

Installation

OS X

You can install fast-http-server via Brew.

brew tap sdogruyol/fast-http-server
brew install fast-http-server

Manual

fast-http-server requires Crystal 0.22.0 You can install it here

git clone https://github.com/sdogruyol/fast-http-server
crystal build --release src/fast-http-server.cr
mv fast-http-server /usr/local/bin/fast-http-server

Protip

For quick use, add

alias fhs='fast-http-server'

to your .bashrc | .zshrc | Profile file