Skip to content

c0rrzin/router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Go Router

Installing

$ go get github.com/c0rrzin/router

Usage

Importing

import "github.com/c0rrzin/router"

Defining routes

router.DefRoute("POST", "/", func(w http.ResponseWriter, r *http.Request) {
  fmt.Fprintf(w, "Hello POST")
})
router.DefRoute("GET", "/", func(w http.ResponseWriter, r *http.Request) {
  fmt.Fprintf(w, "Hello GET")
})

Registering routes

Before you instantiate the server:

func main() {
  ...

  router.RouteAll()

  ...
}

About

Go simple HTTP method routing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages