Go 開發的 Http 中間件:Negroni

jopen 10年前發布 | 43K 次閱讀 Negroni Google Go/Golang開發

Negroni 是 Go 開發的 Http 中間件,非常小,沒有侵入性,鼓勵使用 ofnet/http 處理程序。如果你喜歡 Martini,又覺得它太過于復雜,那么 Negroni 非常適合你。

package main

import ( "github.com/codegangsta/negroni" "net/http" "fmt" )

func main() { mux := http.NewServeMux() mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { fmt.Fprintf(w, "Welcome to the home page!") })

n := negroni.Classic() n.UseHandler(mux) n.Run(":3000") }</pre>

項目主頁:http://www.baiduhome.net/lib/view/home/1401540324011

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!