types.go 622 B

123456789101112131415161718192021222324252627282930313233343536
  1. package rest
  2. import "net/http"
  3. type (
  4. // Middleware defines the middleware method.
  5. Middleware func(next http.HandlerFunc) http.HandlerFunc
  6. // A Route is a http route.
  7. Route struct {
  8. Method string
  9. Path string
  10. Handler http.HandlerFunc
  11. }
  12. // RouteOption defines the method to customize a featured route.
  13. RouteOption func(r *featuredRoutes)
  14. jwtSetting struct {
  15. enabled bool
  16. secret string
  17. prevSecret string
  18. }
  19. signatureSetting struct {
  20. SignatureConf
  21. enabled bool
  22. }
  23. featuredRoutes struct {
  24. priority bool
  25. jwt jwtSetting
  26. signature signatureSetting
  27. routes []Route
  28. }
  29. )