server

package
v0.0.0-...-4dbeb52 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package server contains Http server and routes for processing requests

Package server Generic simple http server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chain

func Chain(f http.HandlerFunc, middlewares ...Middleware) http.HandlerFunc

Chain applies middlewares to a http.HandlerFunc

func StartServer

func StartServer(address string, security bool)

StartServer Start Http server on given port If bindAll is true, will bind to all interfaces Otherwise, will bind to localhost only

Types

type Middleware

type Middleware func(http.HandlerFunc) http.HandlerFunc

Middleware - Define middleware method

func Cors

func Cors(allowedMethod string) Middleware

Cors Implement CORS browser ehaders

func Limit

func Limit(limiter *rate.Limiter) Middleware

Limit - Requst limiter for protection

func Logging

func Logging(isDebug bool) Middleware

Logging is Generic http request logging Logging logs all requests with its path and the time it took to process

func Method

func Method(m string) Middleware

Method ensures that url can only be requested with a specific method, else returns a 400 Bad Request

Jump to

Keyboard shortcuts

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