Skip to content

kidtronnix/gogogo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gogogo

fast and simple http routing. written in go.

Build Status Coverage Status

About

At it's core gogogo is a fast simple http router. It matches requests to handlers by using a Trie data structure. Typically this approach scales well.

As a bonus, gogogo will parse url params as it routes requests.

Best of all gogogo let's you keep your standard http handlers!

Usage

func createHandler(w http.ResponseWriter, req *http.Request) {
  // ...
}

func idHandler(w http.ResponseWriter, req *http.Request) {
  id := req.FormValue("id")
  // get :id url param then ...
}

func main() {

  // create router instance
  r := gogogo.NewRouter()

  // let's add a create handler for our resource
  r.HandleFunc("/resources/", createHanlder, "POST")

  // you can add multiple methods to a handler
  r.HandleFunc("/resources/:id", idHandler, "GET", "PUT", "DELETE")

  http.ListenAndServe(":8000", r)
}

Credits

Great explanation of how to use a trie data structure to write a router in golang.

http://vluxe.io/golang-router.html

About

fast and simple http router. written in go.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages