servedir

command module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2025 License: MIT Imports: 11 Imported by: 0

README

servedir

CI Go Report Card Go Reference

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.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Author

Atsushi Nagase

License

Copyright © 2018 Atsushi Nagase. All rights reserved.

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL