Skip to content

Create TCP/HTTP servers in Haxe, or start a simple HTTP server from the command line ๐Ÿ

License

Notifications You must be signed in to change notification settings

BowlerHatLLC/snake-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

34 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Snake Server for Haxe

Create TCP and HTTP servers with the Haxe programming language, or run haxelib run snake-server to start a local HTTP server that serves static files in a specific directory.

Warning! snake-server is not recommended for production. It only implements basic security checks.

Available on Haxe sys targets only.

Installation

Use the haxelib install command to launch Snake Server in the current directory on port 8000.

haxelib install snake-server

Requires Haxe 4.1 or newer.

Command Line

Use the haxelib run command to download Snake Server.

haxelib run snake-server

Options

The following options can be added to the haxelib run snake-server command to customize its behavior.

  • --bind address

    bind to this address (default: 127.0.0.1)

  • --directory path/to/dir

    serve this directory (default: current directory)

  • --protocol HTTP/X.Y

    conform to this HTTP version (default: HTTP/1.0)

  • --port number

    bind to this port (default: 8000)

Example:

haxelib run snake-server --address 0.0.0.0 --port 3000 --protocol HTTP/1.1 --directory www

Haxe Documentation

Why did you choose "snake" for the name? ๐Ÿ

The Snake Server project's Haxe code is actually ported from the Python language's http.server and socketserver modules. Pythons are also a type of snake. The name is simply meant to pay tribute to the code's origins.