Skip to content
/ router Public

This is a golang HTTP router that implements a trie data structure for optimal performance.

License

Notifications You must be signed in to change notification settings

dndungu/router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoDoc Build Status codecov GoDoc Go Report Card Issue Count

router

This is a golang HTTP router that implements a trie data structure for optimal performance.

Example

package main

import (
	"fmt"
	"github.com/zatiti/router"
	"net/http"
)

func main() {
	r := router.New(DefaultHandler)
	r.Get("/test/:test_id", HandlerA, HandlerB, HandlerC)
	http.ListenAndServe(":8080", r)
}

func DefaultHandler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprint(w, "Hello")
}

func HandlerA(w http.ResponseWriter, r *http.Request) {
	fmt.Fprint(w, "A")
}

func HandlerB(w http.ResponseWriter, r *http.Request) {
	fmt.Fprint(w, "B")
}

func HandlerC(w http.ResponseWriter, r *http.Request) {
	fmt.Fprint(w, "C")
}

About

This is a golang HTTP router that implements a trie data structure for optimal performance.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages