command
module
Version:
v0.2.0
Opens a new window with list of versions in this module.
Published: Jun 11, 2026
License: MIT
Opens a new window with license information.
Imports: 9
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
go-serve
A simple and efficient concurrent static file server written in Go.
Features
- High speed and great for concurrent request handling.
- Configurable file cache capacity to improve performance.
- Configurable logging levels (Error, Warn, Info).
- Built-in diagnostics server (pprof) accessible on port 8081.
- Serves Multiple routes for different purposes:
GET /: For serving static files. Does not require Authorization headers.
POST /: For creating new files with the payload in request body and adding them to cache. Requires Authorization headers.
PUT /: For updating existing files with the payload in request body and adding/updating them to cache. Requires Authorization headers.
GET /test: For testing speed accurately without disk I/O overhead. Requires Authorization headers.
Installation
- Ensure you have Go installed on your system.
- Build the project:
Usage
You can run the server using the generated binary:
go-serve [options]
Options
-p: Set the port (default: 8000).
-d: Set the directory to serve (default: .).
-c: Set the cache entry limit (default: 64).
-l: Set the log level threshold (options: Error, Warn, Info; default: Warn).
Example:
go-serve -p 3000 -d ./web -c 128 -l Info
The server will start and output its address to standard error.
Development
main.go: Entry point and server configuration.
handlers/: Request handler logic.
utils/: Utilities for logging, caching, and types.
See CONTRIBUTING.md for information about contributing to the project.
See CHANGELOG.md for news and changes about the project.
License
MIT License
Documentation
¶
There is no documentation for this package.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.