Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rhardih/serve
Simple http server for localhost development with flags for enabling gzip and http2
https://github.com/rhardih/serve
golang gzip http http2 https localhost
Last synced: 2 months ago
JSON representation
Simple http server for localhost development with flags for enabling gzip and http2
- Host: GitHub
- URL: https://github.com/rhardih/serve
- Owner: rhardih
- License: mit
- Created: 2016-04-26T04:05:54.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-05-02T19:01:08.000Z (9 months ago)
- Last Synced: 2024-06-21T00:13:42.356Z (8 months ago)
- Topics: golang, gzip, http, http2, https, localhost
- Language: Go
- Homepage:
- Size: 17.6 KB
- Stars: 101
- Watchers: 2
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# serve
Simple http server for localhost development.It's like `python -m SimpleHTTPServer`, but with support for gzip and HTTP/2.
## Installation
```bash
go install github.com/rhardih/serve/v3@latest
```## Usage
If $GOPATH/bin is in your $PATH, simply:
```
$ serve -h
NAME:
serve - deliver content of current directory via http/httpsUSAGE:
serve [global options] command [command options] [arguments...]VERSION:
2.0.0COMMANDS:
help, h Shows a list of commands or help for one commandGLOBAL OPTIONS:
--gzip, -g enable gzip encoding (default: false)
--port value, -p value specify port for listening (default: 8080)
--logging, -l enable logging output (default: false)
--http2, -2 enable http2, this generates a self signed certificate, if one isn't already present; cert.pem, key.pem (default: false)
--header value, -H value custom header(s) to add to the response (can be repeated multiple times)
--cert-save, --sc whether to save the generated self-signed certificates to disk (default: false)
--cert-dir value, --cd value location to save certificate at if saving to disk (default: "/Users/rene/.serve")
--help, -h show help (default: false)
--version, -v print the version (default: false)```
## Note
Code for generating self-signed certificate for HTTP/2 was taken from example code in `src/crypto/tls/generate_cert.go`, available at [https://golang.org/src/crypto/tls/generate_cert.go](https://golang.org/src/crypto/tls/generate_cert.go).