An open API service indexing awesome lists of open source software.

https://github.com/arran4/gorillamuxlogic

Some very simple gorilla mux logic for `mux.MatcherFunc`
https://github.com/arran4/gorillamuxlogic

go golang gorilla gorilla-mux http web

Last synced: 7 months ago
JSON representation

Some very simple gorilla mux logic for `mux.MatcherFunc`

Awesome Lists containing this project

README

          

# Gorilla Mux Logic

Simple primitive enabling logic like this:

```go
package main

import (
. "github.com/arran4/gorillamuxlogic"
"github.com/gorilla/mux"
)

func main() {
mux.NewRouter().
Use(UserMiddleware).
HandleFunc("/blog/{blog}/comment/{comment}/edit", blogsCommentEditPage).
MatcherFunc(Or(RequiredScopes("administrator"), CommentAuthor())).
Methods("POST")
}
```

Provides functions:
```go
func And(matchers ...mux.MatcherFunc) mux.MatcherFunc

func Or(matchers ...mux.MatcherFunc) mux.MatcherFunc

func Not(matcher mux.MatcherFunc) mux.MatcherFunc

```