Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hobord/go_static_httpfs
https://github.com/hobord/go_static_httpfs
Last synced: 27 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/hobord/go_static_httpfs
- Owner: hobord
- Created: 2019-04-02T15:01:10.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-30T10:52:07.000Z (over 5 years ago)
- Last Synced: 2024-06-21T21:05:37.336Z (8 months ago)
- Language: Go
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Static http file server
Serve is a very simple static file server in go.
You can map/share a directory with specific base uri, and you can show/hide the directory indexes.
It is support basic cache control headers.
- keepalive
- cace-controll
- Last-ModifiedIt is support serve prometius metrics also.
## Docker
image: hobord/go_static_httpfs
```
docker run -p 8100:8100 -v ./your_public:/app/public -e DIRECTORY=/app/public -e LOG=true hobord/go_static_httpfs
```## Build
linux || mac
```
go get ./...
go build -o server server.go
```windows
```
go get ./...
go build -o server.exe server.go
```## Usage
```
-p="8100" or env.PORT: port to serve on
-d="." or env.DIRECTORY: the directory of static files to host
-b="/" or env.BASE_URI: base uri of static files on the web
-k="300" or env.KEEPALIVE: http header keep-alive value
-c="max-age=2800" or env.CACHECONTROL: http header Cache-controll: value
-i="true" or env.DIRINDEX: show directories index
-l="true" or env.LOG: show requests logs
-m="true" or env.METRICS: generate / serve metrics
-mp="9090" or env.METRICS_PORT: serve metrics on port
```