msv

package module
v0.0.0-...-8986e6e Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2020 License: MIT Imports: 10 Imported by: 1

README

MSV - Minimal HTTP Server in Go

Build Status codecov Go Report Card Maintainability

MSV is a minimal server implementation in Go. It wraps Gorilla multiplexer, lifecycle control, graceful shutdown and common middleware into a single reusable package.

Introduction

Whenever I start working on a new project, the packages implemented in msv are the ones I always tend to write from scratch. The idea for msv is to prevent that, and keep the common server implementation reusable for multiple projects.

What's included

MSV includes the following packages:

  • MSV (Server): Basic server implementation that wraps gorilla/mux with net/http server. Includes graceful shutdown and Start methods on server.
  • Render: Marshalls and validates HTTP requests. Writes HTTP responses and status codes to clients.
  • Middleware: Includes various http middlewares:
    • bauth: HTTP Basic Authentication
    • httplog: HTTP Request/Response logging
    • recovery: HTTP panics recoverer

License

MSV is licensed under the MIT license. Check the LICENSE file for details.

Author

Emir Ribic

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	*http.Server
	// contains filtered or unexported fields
}

Server represents http server

func New

func New(prefix string) (*Server, *mux.Router)

New instantiates new http server with logging and recover middleware

func (*Server) Start

func (s *Server) Start() error

Start starts the http server

func (*Server) StartTLS

func (s *Server) StartTLS(cf, kf string) error

StartTLS starts the https server

Directories

Path Synopsis
middleware
httplog
Package httplog is a fork of https://github.com/unrolled/logger
Package httplog is a fork of https://github.com/unrolled/logger
recovery
Package recovery is a fork of https://github.com/unrolled/recovery
Package recovery is a fork of https://github.com/unrolled/recovery

Jump to

Keyboard shortcuts

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