servedir
A simple HTTP file server with Apache-style logging for serving static files from any directory.
Features
- 🚀 Simple and lightweight HTTP file server
- 📝 Apache Combined Log Format output
- 🔧 Configurable port
- 🖥️ Auto-open browser (cross-platform)
- 📁 Serve any directory
Installation
Using Go Install
go install go.ngs.io/servedir@latest
Download Binary
Download the latest binary from the releases page.
Build from Source
git clone https://github.com/ngs/servedir.git
cd servedir
make build
Usage
Basic Usage
Serve current directory on any available port:
servedir
Serve Specific Directory
servedir /path/to/directory
Custom Port
servedir -port 8080 .
Auto-open Browser
servedir -open -port 8123 .
Command Line Options
-port int HTTP Port to Listen (default 0, any available port)
-open Open browser on started
Development
Prerequisites
- Go 1.21 or later
- Make (optional)
Building
make build
Testing
make test
Running Locally
make run
Available Make Commands
make help # Show all available commands
make build # Build the binary
make test # Run tests
make coverage # Generate coverage report
make lint # Run golangci-lint
make fmt # Format code
make clean # Remove build artifacts
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Author
License
Copyright © 2018 Atsushi Nagase. All rights reserved.
This project is licensed under the MIT License - see the LICENSE file for details.