Help us shape the future of Go! Take the 2026 Go Developer Survey

qps

package module
v0.0.0-...-e01384d Latest Latest
Warning

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

Go to latest
Published: May 30, 2016 License: MIT Imports: 4 Imported by: 0

README

qps-middleware

qps-middleware for go http package.

example

define some routes with gorilla middlware (cors, logger, etc.) and qps middleware:

package main

import (
	"log"
	"net/http"
	
	"github.com/gorilla/handlers"
	"github.com/gorilla/mux"
	"github.com/streamrail/qps-middleware"
)

func main() {
	r := mux.NewRouter()


	r.Path("/someHandler").HandlerFunc(someHandler).Methods("GET")

	loggedRouter := handlers.CombinedLoggingHandler(os.Stdout, r)
	qpsRouter := qps.QPSHandler()(loggedRouter)
	finalHandler := handlers.CompressHandler(qpsRouter)


	http.Handle("/", finalHandler)
	log.Fatalf(http.ListenAndServe(":8080", nil).Error())
}


func someHandler(rw http.ResponseWriter, req *http.Request) {
	//Handle Something
}

License

MIT (see LICENSE.txt file)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QPSHandler

func QPSHandler() func(h http.Handler) http.Handler

Types

This section is empty.

Jump to

Keyboard shortcuts

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