- Notifications
You must be signed in to change notification settings - Fork1
Simple web application server library built upon Go's net/http and doesn't force any framework.
License
NotificationsYou must be signed in to change notification settings
ashcrow/go-serv
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
go-serv attempts to take care of common requirements for web applications while not dictating any specific Go web framework.
Repo:https://github.com/ashcrow/go-serv/
Warning: Currently in development with no official release yet.
- Built on Go's net/http library
- Framework agnostic
- Logging via logrus (https://github.com/Sirupsen/logrus/)
- Configuration file parsing via TOML (https://github.com/toml-lang/toml/)
- Flags through pflag (https://github.com/ogier/pflag)
- Command line flags which can overrule configuration file
- Simple status/health system for exposing structs
- Run HTTP and HTTPS servers with the same binary.
$ go get gopkg.in/ashcrow/go-serv.v0
$ gotest -v -cover
or
$ maketest
# Note that the names are the same across the BaseConfiguration# struct, this config file, and command line flags.BindAddress = "127.0.0.1"BindPort = 8000LogLevel = "info"LogFile = "/tmp/out.log"
$ ./status-example -helpUsage of ./status-example: --BindAddress="0.0.0.0": Bind address. --BindHttpsPort=443: HTTPSbind port. --BindPort=80: HTTPbind port. --CertFile="": Cert file. --KeyFile="": Key file. --LogFile="": Log file. --LogLevel="info": Log level. --MaxHeaderBytes=1048576: Max header bytes. --ReadTimeout=10s: Read timeout. --WriteTimeout=10s: Write timeout.
$ ./status-example -help /path/to/conf.tomlUsage of ./status-example: --BindAddress="127.0.0.1": Bind address. --BindHttpsPort=8181: HTTPSbind port. --BindPort=8000: HTTPbind port. --CertFile="./cert.pem": Cert file. --KeyFile="./key.pem": Key file. --LogFile="/tmp/out.log": Log file. --LogLevel="info": Log level. --MaxHeaderBytes=1048576: Max header bytes. --ReadTimeout=10s: Read timeout. --WriteTimeout=10s: Write timeout.
Examples can be found in theexamples folder
There is a Makefile provided to build the code in the examples folder.
$ make build-examples-all