handlers

A collection of useful handlers for Go's net/http package.

Github星跟蹤圖

gorilla/handlers

GoDoc
CircleCI
Sourcegraph

Package handlers is a collection of handlers (aka "HTTP middleware") for use
with Go's net/http package (or any framework supporting http.Handler), including:

Other handlers are documented on the Gorilla
website
.

Example

A simple example using handlers.LoggingHandler and handlers.CompressHandler:

import (
    "net/http"
    "github.com/gorilla/handlers"
)

func main() {
    r := http.NewServeMux()

    // Only log requests to our admin dashboard to stdout
    r.Handle("/admin", handlers.LoggingHandler(os.Stdout, http.HandlerFunc(ShowAdminDashboard)))
    r.HandleFunc("/", ShowIndex)

    // Wrap our server with our gzip handler to gzip compress all responses.
    http.ListenAndServe(":8000", handlers.CompressHandler(r))
}

License

BSD licensed. See the included LICENSE file for details.

主要指標

概覽
名稱與所有者gorilla/handlers
主編程語言Go
編程語言Go (語言數: 2)
平台
許可證BSD 3-Clause "New" or "Revised" License
所有者活动
創建於2013-02-01 03:53:49
推送於2024-02-20 16:27:20
最后一次提交
發布數10
最新版本名稱v1.5.2 (發布於 )
第一版名稱v1.1 (發布於 )
用户参与
星數1.7k
關注者數29
派生數275
提交數198
已啟用問題?
問題數122
打開的問題數17
拉請求數81
打開的拉請求數7
關閉的拉請求數52
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?