This repository has been archived by the owner on Dec 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
/
router.go
54 lines (40 loc) · 2.45 KB
/
router.go
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright 2020 CleverGo. All rights reserved.
// Use of this source code is governed by a MIT style license that can be found
// in the LICENSE file.
package clevergo
import "net/http"
// Router is an router interface.
type Router interface {
// Group creates a sub Router with the given optional route group options.
Group(path string, opts ...RouteGroupOption) Router
// Get registers a new GET request handler function with the given path and optional route options.
Get(path string, handle Handle, opts ...RouteOption)
// Head registers a new HEAD request handler function with the given path and optional route options.
Head(path string, handle Handle, opts ...RouteOption)
// Options registers a new Options request handler function with the given path and optional route options.
Options(path string, handle Handle, opts ...RouteOption)
// Post registers a new POST request handler function with the given path and optional route options.
Post(path string, handle Handle, opts ...RouteOption)
// Put registers a new PUT request handler function with the given path and optional route options.
Put(path string, handle Handle, opts ...RouteOption)
// Patch registers a new PATCH request handler function with the given path and optional route options.
Patch(path string, handle Handle, opts ...RouteOption)
// Delete registers a new DELETE request handler function with the given path and optional route options.
Delete(path string, handle Handle, opts ...RouteOption)
// Any registers a new request handler function that matches any HTTP methods with the given path and
// optional route options. GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH.
Any(path string, handle Handle, opts ...RouteOption)
// HandleFunc registers a new request handler function with the given path, method and optional route options.
//
// For Get, Head, Options, Post, Put, Patch and Delete requests the respective shortcut
// functions can be used.
//
// This function is intended for bulk loading and to allow the usage of less
// frequently used, non-standardized or custom methods (e.g. for internal
// communication with a proxy).
Handle(method, path string, handle Handle, opts ...RouteOption)
// Handler is an adapter for registering http.Handler.
Handler(method, path string, handler http.Handler, opts ...RouteOption)
// HandlerFunc is an adapter for registering http.HandlerFunc.
HandlerFunc(method, path string, f http.HandlerFunc, opts ...RouteOption)
}