项目作者: faryon93

项目描述 :
A set of frequently used Go http handlers
高级语言: Go
项目地址: git://github.com/faryon93/handlers.git
创建时间: 2018-03-23T11:20:41Z
项目社区:https://github.com/faryon93/handlers

开源协议:MIT License

下载


Handlers

Documentation
Go Report Card
Last Release

A set of frequently used Go http handlers and middleware functions.

  1. # download library
  2. $: go get github.com/faryon93/handlers
  3. # place on top of your go file
  4. import "github.com/faryon93/handlers"

Content: Handlers

Handler Description
Forbidded() Default 403 forbidden handler.
NoRobots() Writes a robots.txt file, which disallows the access to everything.

Content: Adapters

Adapter functions can be chained with the real handler function or other adapter functions.

Adapter Description
CORS(age, orgins) Configures gorilla/handlers/cors in a convenient way
Benchmark() Logs the execution time of every request using logrus
Enabled(en) Denys access if en is false
Keyed(reqKey) Restrict access to requests, having param “key” matching reqKey
Paged(limit) Paging: Parses skip and limit from query parameters
Recaptcha(key) Restricts access if recaptcha is invalid
RestrictOrigin(orgins…) Rejects all request having an origin which is not on the list