- Multithreaded with a customizable thread pool
- Native ARM support
- Serve directories, webserver directory index style
- Test and serve static sites of all kinds (regular HTML, built React, etc.)
- Serve static sites in Docker
- Optional hot reloading
- Optional basic auth
- Glob patterns for including/excluding files
- WinGet
winget install SpikeHD.swerve
Note
Maintaining swerve
somewhere else? Feel free to add it here!
You can obtain binaries through releases, GitHub Actions artifacts, or by building from source!
# Run the install script
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/SpikeHD/swerve/refs/heads/main/install.ps1" -OutFile "$env:TEMP\install.ps1"; PowerShell -ExecutionPolicy Bypass -File "$env:TEMP\install.ps1"
# You can uninstall by deleting C:\Program Files\Swerve
del C:\Program Files\Swerve
# Run the install script
curl -fsSL https://raw.githubusercontent.com/SpikeHD/swerve/refs/heads/main/install.sh | sudo bash
# You can uninstall by removing the binary from /usr/local/bin
rm /usr/local/bin/swerve
# Run the install script
curl -fsSL https://raw.githubusercontent.com/SpikeHD/swerve/refs/heads/main/install.sh | sudo bash
# You can uninstall by removing the binary from /usr/local/bin
rm /usr/local/bin/swerve
# Show help
swerve -h
# Serve the current directory
swerve
# Serve a specific directory
swerve path/to/directory
# Specify port
swerve -p 8080
# Enable hot reloading. This creates a websocket on port 8087.
swerve -H 8087
# Set basic auth credentials
swerve --basic-auth username:password
# Include files using a glob pattern
swerve -i *.html -i *.css -i *.js
# Exclude files using a glob pattern
swerve -e *.txt -e *.md
# Expose to the internet
swerve -p 8080 --bind 0.0.0.0
FROM ubuntu:latest
RUN echo "<html><body><h1>Hello World</h1></body></html>" > ./index.html
RUN apt update && apt install -y curl
RUN curl -fsSL https://raw.githubusercontent.com/SpikeHD/swerve/refs/heads/main/install.sh | bash
EXPOSE 8080
CMD ["swerve", "--port", "8080", "--bind", "0.0.0.0", "-r"]
You can access this by running the following:
docker build . --tag swerve-test
docker run -p 8080:8080 swerve-test
- Clone the repository
git clone https://github.com/SpikeHD/swerve.git
cd
into the repository
cd swerve
- Build the project
cargo build --release
The binary will be in target/release/
.
- Include/exclude files/folders/globs
- Embedded HTML/CSS for displaying directories
- Optional hot-reloading
- Multithreading
- More details in directory listings (modified date, size, etc.)
- Basic auth
Issues, PRs, etc. are all welcome!