-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathroute.go
More file actions
37 lines (28 loc) · 1.03 KB
/
route.go
File metadata and controls
37 lines (28 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package httpserver
import (
"net/http"
"time"
)
// Route contains the HTTP route description.
type Route struct {
// Method is the HTTP method (e.g.: GET, POST, PUT, DELETE, ...).
Method string `json:"method"`
// Path is the URL path.
Path string `json:"path"`
// Description is the description of this route that is displayed by the /index endpoint.
Description string `json:"description"`
// Handler is the handler function.
Handler http.HandlerFunc `json:"-"`
// Middleware is a set of middleware to apply to this route.
Middleware []MiddlewareFn `json:"-"`
// DisableLogger disable the default logger when set to true.
DisableLogger bool `json:"-"`
// Timeout time limit after which a request receives a 503 Service Unavailable.
// If set, overrides the common value set with WithRequestTimeout.
Timeout time.Duration `json:"-"`
}
// Index contains the list of routes attached to the current service.
type Index struct {
// Routes is the list of routes attached to the current service.
Routes []Route `json:"routes"`
}