Skip to content
Go Server/API micro framwework, HTTP request router, multiplexer, mux
Branch: master
Clone or download
Latest commit eab65e0 Feb 5, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Adds dep setup, updates contributing.md to reflect process change. Jun 5, 2018
.gitignore Adds dep setup, updates contributing.md to reflect process change. Jun 5, 2018
.hound.yml
.travis.yml Refactor methods naming Feb 26, 2018
LICENSE.md
README.md Add wiki pages as advanced examples Jun 26, 2018
benchmark_test.go Remove dependency Feb 5, 2019
context.go
context_test.go Rename package Jun 1, 2017
doc.go Add more example tests Feb 23, 2018
example_test.go
middleware.go Rename package Jun 1, 2017
middleware_test.go
node.go Panic if regex is invalid Feb 26, 2018
node_test.go Refactor methods naming Feb 26, 2018
param.go Rename package Jun 1, 2017
path.go Use tree for root routes (method) Dec 7, 2017
route.go Refactor methods naming Feb 26, 2018
route_test.go Refactor methods naming Feb 26, 2018
router.go Update panic message Feb 2, 2019
router_test.go Check if string contains instead of compering value Feb 26, 2018
tree.go Panic if regex is invalid Feb 26, 2018
tree_test.go Refactor methods naming Feb 26, 2018

README.md

Vardius - gorouter

Build Status Go Report Card codecov license Beerpay Beerpay

Go Server/API micro framwework, HTTP request router, multiplexer, mux.

ABOUT

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.

HOW TO USE

  1. GoDoc
  2. Documentation
  3. Benchmarks
  4. Go Server/API boilerplate using best practices DDD CQRS ES

Basic example

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))
}

Advanced examples

License

This package is released under the MIT license. See the complete license in the package:

LICENSE

You can’t perform that action at this time.