Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```go
- import (
- mwr "github.com/gilcrest/go-API-template/pkg/api/server/middleware"
- "github.com/gilcrest/go-API-template/pkg/env"
- "github.com/gorilla/mux"
- )
- // Dispatch is a way of organizing routing to handlers (versioning as well)
- func Dispatch(env *env.Env, rtr *mux.Router) *mux.Router {
- // initialize new instance of APIAudit
- audit := new(mwr.APIAudit)
- // match only POST requests on /api/v1/appUser/create
- rtr.Handle("/v1/appUser", mwr.Adapt(Handler{env, CreateUserHandler},
- mwr.LogRequest(env, audit),
- mwr.LogResponse(env, audit))).
- Methods("POST").
- Headers("Content-Type", "application/json")
- return rtr
- }
- ```
Add Comment
Please, Sign In to add comment