Go Server/API micro framwework, HTTP request router, multiplexer, mux.
Contributors:
Want to contribute ? Feel free to send pull requests!
Have problems, bugs, feature ideas? We are using the github issue tracker to manage them.
package main
import (
"fmt"
"log"
"net/http"
"github.com/vardius/gorouter"
)
func Index(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Welcome!\n")
}
func Hello(w http.ResponseWriter, r *http.Request) {
params, _ := gorouter.FromContext(r.Context())
fmt.Fprintf(w, "hello, %s!\n", params.Value("name"))
}
func main() {
router := gorouter.New()
router.GET("/", http.HandlerFunc(Index))
router.GET("/hello/{name}", http.HandlerFunc(Hello))
log.Fatal(http.ListenAndServe(":8080", router))
}
- Routing
- Middleware
- Mounting Sub Router
- Serving Files
- Authentication
- Handling Errors
- HTTP2
- Multidomain
This package is released under the MIT license. See the complete license in the package: