static-serve

command module
v0.0.0-...-99bf142 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: MIT Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

static-serve

Static-serve is a very simple and efficient static file server written in Go.

Usage:
	-p: ports to serve on (default: 8100)
	-d: the directories of static files to host (default: ./)
	-e: the files to serve in case of error 404 (- to disable error404 handler)
	-l: log access requests
	-hport: the port on which /health and /ready endpoints should be served
	-r	log request/response headers
	-tls-cert string
		path to a TLS certificate
	-tls-key string
		path to the key of the TLS certificate
	-v: verbose logging (e.g. when handling error 404)
	    Ports, directories and error404 flags can be specified multiple times,
	    but need to be specified the same amount of times.
	-version
	    print the version and exit

Static-serve does not show directory listings, it only serves files.

Since static-serve uses Go's http.FileServer we have the following features out of the box:

  • basic mime type detection
  • caching headers
  • range requests

It's possible to serve over TLS by specifying both --tls-cert and --tls-key file paths.

Not supported:

  • Dynamic pages (e.g. templating, changing response body, ...). It's called static-serve for a reason 😉

Documentation

Overview

Static-serve is a very simple static file server in go Usage:

-p="8100": port to serve on
-d=".":    the directory of static files to host
-e="":     a file to serve in case of error 404
-l:        log access requests

Static-serve does not show directory listings, it only serves files.

Jump to

Keyboard shortcuts

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