Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alshdavid/http-server-rs
Static HTTP Server For Local Development
https://github.com/alshdavid/http-server-rs
Last synced: 26 days ago
JSON representation
Static HTTP Server For Local Development
- Host: GitHub
- URL: https://github.com/alshdavid/http-server-rs
- Owner: alshdavid
- License: mit
- Created: 2024-07-17T03:44:39.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-31T00:13:51.000Z (4 months ago)
- Last Synced: 2024-11-24T19:19:12.575Z (about 1 month ago)
- Language: Handlebars
- Size: 118 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# http-server: a simple static HTTP server 🚀🦀
Rewrite of the popular npm package [http-server](https://github.com/http-party/http-server/tree/master) in Rust with some extras included.
`http-server` is a simple, zero-configuration command-line static HTTP server. It is powerful enough for production usage, but it's simple and hackable enough to be used for testing, local development and learning.
## Usage
```bash
# Use default configuration
http-server# Arguments
http-server --no-cache --cors ./public# Custom Headers
http-server -H Cross-Origin-Opener-Policy:same-origin
``````
Usage: http-server [OPTIONS] [SERVE_DIR]Arguments:
[SERVE_DIR] Target directory to serve [default: ./dist]Options:
[default: 0.0.0.0]
-a, --address
-p, --port [default: 8080]
--spa Redirect requests to /index.html for Single Page Applications
-c, --cache-time Cache control time [default: 0]
-H, --header Custom headers (Format "key:value")
--cors Enable CORS header
--no-cache Disable cache control header
-Q, --quiet Don't print any logs to terminal
-w, --watch Watch folder for changes and trigger a browser reload
--watch-dir Watch for changes [default: SERVE_DIR]
--no-watch-inject Don't automatically inject watch listener into html
-h, --help Print help
```## Installation
### MacOS & Linux
#### Install & Update Script
This will prompt you for the install path, run it again to update the version
```shell
curl -s "https://raw.githubusercontent.com/alshdavid/http-server-rs/main/scripts/install.sh" | sh
```#### Manual
Download the binary from the [latest GitHub release](https://github.com/alshdavid-labs/alshx/releases/latest) and add it to your `PATH`
```shell
# Linux AMD64
curl -L --url https://github.com/alshdavid/http-server-rs/releases/latest/download/linux-amd64.tar.gz | tar -xvzf - -C $HOME/.local/bin --strip-components=1# Linux ARM64
curl -L --url https://github.com/alshdavid/http-server-rs/releases/latest/download/linux-arm64.tar.gz | tar -xvzf - -C $HOME/.local/bin --strip-components=1# MacOS ARM64 (Apple Silicon)
curl -L --url https://github.com/alshdavid/http-server-rs/releases/latest/download/macos-arm64.tar.gz | tar -xvzf - -C $HOME/.local/bin --strip-components=1# MacOS AMD64 (Intel)
curl -L --url https://github.com/alshdavid/http-server-rs/releases/latest/download/macos-amd64.tar.gz | tar -xvzf - -C $HOME/.local/bin --strip-components=1# Add to PATH if not already there:
echo "\nexport \PATH=\$PATH:\$HOME/.local/bin\n" >> $HOME/.zshrc
echo "\nexport \PATH=\$PATH:\$HOME/.local/bin\n" >> $HOME/.bashrc
```### Windows
Download the binary from the [latest GitHub release](https://github.com/alshdavid-labs/alshx/releases/latest) and add it to your `PATH`