Skip to content

Simple web application server library built upon Go's net/http and doesn't force any framework.

License

Notifications You must be signed in to change notification settings

ashcrow/go-serv

Repository files navigation

go-serv

GoDoc Travis

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.

Features

Installation

$ go get gopkg.in/ashcrow/go-serv.v0

Unittesting

$ go test -v -cover

or

$ make test

Configuration File Example

# Note that the names are the same across the BaseConfiguration
# struct, this config file, and command line flags.
BindAddress = "127.0.0.1"
BindPort    = 8000
LogLevel    = "info"
LogFile     = "/tmp/out.log"

Default Command Line Flags

Application Defaults

$ ./status-example -help
Usage of ./status-example:
  --BindAddress="0.0.0.0": Bind address.
  --BindHttpsPort=443: HTTPS bind port.
  --BindPort=80: HTTP bind 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.

Configuration File Defaults

$ ./status-example -help /path/to/conf.toml
Usage of ./status-example:
  --BindAddress="127.0.0.1": Bind address.
  --BindHttpsPort=8181: HTTPS bind port.
  --BindPort=8000: HTTP bind 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

Examples can be found in the examples folder

Building Examples

There is a Makefile provided to build the code in the examples folder.

$ make build-examples-all

About

Simple web application server library built upon Go's net/http and doesn't force any framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published