-
Notifications
You must be signed in to change notification settings - Fork 0
/
joke.go
67 lines (64 loc) · 1.48 KB
/
joke.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
55
56
57
58
59
60
61
62
63
64
65
66
67
package routes
import (
"github.com/Sakagam1/DBMS_TASK/internal/handlers"
"github.com/Sakagam1/DBMS_TASK/internal/router"
)
var Joke = router.RoutePrefix{
Prefix: "/joke",
SubRoutes: []router.Route{
{
Name: "CreateJoke",
Method: "POST",
Pattern: "/create/",
HandlerFunc: handlers.CreateJokeHandler,
},
{
Name: "Delete",
Method: "DELETE",
Pattern: "/delete/",
HandlerFunc: handlers.DeleteJokeHandler,
},
{
Name: "GetJokeByID",
Method: "GET",
Pattern: "/{id}/",
HandlerFunc: handlers.GetJokeByIDHandler,
},
{
Name: "Get",
Method: "GET",
Pattern: "/tags/{id}/",
HandlerFunc: handlers.GetJokeTagsHandler,
},
{
Name: "AddToFavorite",
Method: "POST",
Pattern: "/addToFavorites/",
HandlerFunc: handlers.AddToFavoriteHandler,
},
{
Name: "DeleteFromFavorite",
Method: "DELETE",
Pattern: "/removeFromFavorites/",
HandlerFunc: handlers.DeleteFromFavoriteHandler,
},
{
Name: "AddTagToJoke",
Method: "POST",
Pattern: "/addTag/",
HandlerFunc: handlers.AddTagToJokeHandler,
},
{
Name: "RemoveTagFromJoke",
Method: "POST",
Pattern: "/removeTag/",
HandlerFunc: handlers.DeleteTagFromJokeHandler,
},
{
Name: "CheckIfJokeInFavorites",
Method: "GET",
Pattern: "/isFavorite/{joke_id}/",
HandlerFunc: handlers.CheckIfInFavoriteHandler,
},
},
}