Start a local HTTP server in the current directory.
Simple tool that starts an HTTP file server in the current directory using whatever is available on your system. No need to remember different commands for different languages.
Available via the pancake homebrew formula:
brew install thiagowfx/pancake/pancake# Start server on default port 8000
http_server
# Start server on custom port
http_server 3000
# Show help
http_server --help- Automatically detects and uses the first available tool:
- Python 3 http.server
- Python 2 SimpleHTTPServer
- Perl HTTP::Server::Brick
- Ruby WEBrick server
- Simple interface with sensible defaults
- Clear output showing server location and access URL
# Serve files from current directory on port 8000
http_server
# Serve files on port 4200
http_server 4200
# Access the server
# Open http://localhost:8000 in your browserAt least one of:
- Python 3
- Python
- Perl (with HTTP::Server::Brick module)
- Ruby
0- Server started successfully1- No suitable HTTP server tool found or invalid port
- Server runs in the foreground. Press Ctrl-C to stop.
- Files in the current directory (and subdirectories) will be accessible via the browser.
- Default port is 8000, a commonly used port for development servers.