goserver

package module
v2.1.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2017 License: MIT Imports: 5 Imported by: 2

README

Vardius - goserver

Build Status Coverage Status

Go Server/API micro framwework, HTTP request router, multiplexer, mux.

ABOUT

Contributors:

Want to contribute ? Feel free to send pull requests!

Have problems, bugs, feature ideas? We are using the github issue tracker to manage them.

HOW TO USE

  1. GoDoc
  2. Documentation
  3. Benchmarks

License

This package is released under the MIT license. See the complete license in the package:

LICENSE

Documentation

Overview

Package goserver provide request router with middleware

Index

Constants

View Source
const (
	GET     = "GET"
	POST    = "POST"
	PUT     = "PUT"
	DELETE  = "DELETE"
	PATCH   = "PATCH"
	OPTIONS = "OPTIONS"
)

HTTP methods constants

Variables

This section is empty.

Functions

This section is empty.

Types

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

MiddlewareFunc handles middleware logics

type Param

type Param struct {
	Key   string
	Value string
}

Param object to hold request parameter

type Params

type Params []Param

Params slice returned from request context

func ParamsFromContext

func ParamsFromContext(ctx context.Context) (Params, bool)

ParamsFromContext return parameters from request context

func (Params) Value

func (p Params) Value(key string) string

Value of the request parameter by name

type Server

type Server interface {
	POST(path string, f http.HandlerFunc)
	GET(path string, f http.HandlerFunc)
	PUT(path string, f http.HandlerFunc)
	DELETE(path string, f http.HandlerFunc)
	PATCH(path string, f http.HandlerFunc)
	OPTIONS(path string, f http.HandlerFunc)
	USE(method, path string, fs ...MiddlewareFunc)
	ServeHTTP(http.ResponseWriter, *http.Request)
	ServeFiles(path string, strip bool)
	NotFound(http.Handler)
	NotAllowed(http.Handler)
}

Server interface

func New

func New(fs ...MiddlewareFunc) Server

Creates new Server instance, return pointer

Jump to

Keyboard shortcuts

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