mirror of
https://github.com/ncarlier/webhookd.git
synced 2025-04-07 21:47:09 +00:00
30 lines
616 B
Go
30 lines
616 B
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/ncarlier/webhookd/pkg/config"
|
|
"github.com/ncarlier/webhookd/pkg/middleware"
|
|
)
|
|
|
|
// HandlerFunc custom function handler
|
|
type HandlerFunc func(conf *config.Config) http.Handler
|
|
|
|
// Route is the structure of an HTTP route definition
|
|
type Route struct {
|
|
Path string
|
|
HandlerFunc HandlerFunc
|
|
Middlewares middleware.Middlewares
|
|
}
|
|
|
|
// Routes is a list of Route
|
|
type Routes []Route
|
|
|
|
func route(path string, handler HandlerFunc, middlewares ...middleware.Middleware) Route {
|
|
return Route{
|
|
Path: path,
|
|
HandlerFunc: handler,
|
|
Middlewares: middlewares,
|
|
}
|
|
}
|