go-serve

command module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 9 Imported by: 0

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

  1. Ensure you have Go installed on your system.
  2. Build the project:
  • from root directory:

    go build -o go-serve .
    
  • or using go install:

    go install github.com/Tahaa-Dev/go-serve@latest
    

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

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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