-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
58 lines (45 loc) · 1.76 KB
/
main.go
File metadata and controls
58 lines (45 loc) · 1.76 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
import (
"./handlers"
"./database"
"github.com/valyala/fasthttp"
"github.com/buaazp/fasthttprouter"
)
var router *fasthttprouter.Router
func init() {
router = fasthttprouter.New()
// persons
router.POST("/v1/persons", handlers.CreatePerson)
router.GET("/v1/persons/:person_id", handlers.GetPerson)
// teams
router.GET("/v1/teams/:team_id", handlers.GetTeam)
router.POST("/v1/teams", handlers.CreateTeam)
// players
router.GET("/v1/teams/:team_id/players/:player_id", handlers.GetPlayer)
router.DELETE("/v1/teams/:team_id/players/:player_id", handlers.DeletePlayer)
router.GET("/v1/teams/:team_id/players", handlers.GetTeamPlayers)
router.POST("/v1/players", handlers.CreatePlayer)
// matches
router.GET("/v1/tourney/:tourney_id/matches/:match_id", handlers.GetMatch)
router.PUT("/v1/tourney/:tourney_id/matches/:match_id", handlers.UpdateMatch)
// tournaments
router.GET("/v1/tourney/:tourney_id", handlers.GetTournamentByID)
router.GET("/v1/tourney/:tourney_id/matches", handlers.GetTournamentGrid)
router.POST("/v1/tourney", handlers.CreateTournament)
router.PUT("/v1/tourney/:tourney_id", handlers.UpdateTournament)
// games
router.GET("/v1/games/:game_id/tournaments", handlers.GetTournamentsByGameID)
router.GET("/v1/games/:game_id", handlers.GetGame)
router.GET("/v1/games", handlers.GetGames)
router.POST("/v1/games", handlers.CreateGame)
// Application server
router.GET("/v1/app/activate", handlers.ApplicationActivate)
router.GET("/v1/app/refresh", handlers.ApplicationRefresh)
// Auth server
router.POST("/v1/oauth/authorize", handlers.CreateToken)
router.GET("/v1/oauth/access", handlers.GetToken)
router.GET("/v1/oauth/refresh", handlers.RefreshToken)
}
func main() {
fasthttp.ListenAndServe("localhost:5554", router.Handler)
}