Skip to content

Commit

Permalink
Serve game content and API
Browse files Browse the repository at this point in the history
  • Loading branch information
patapancakes committed Apr 19, 2024
1 parent a36a8f5 commit 6bd7deb
Show file tree
Hide file tree
Showing 4 changed files with 225 additions and 255 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
pokerogue-server*
userdata/*
secret.key
www/
24 changes: 23 additions & 1 deletion api/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,31 @@ import (
"github.com/pagefaultgames/pokerogue-server/db"
)

func Init() {
func Init(mux *http.ServeMux) {
scheduleStatRefresh()
daily.Init()

// account
mux.HandleFunc("GET /api/account/info", handleAccountInfo)
mux.HandleFunc("POST /api/account/register", handleAccountRegister)
mux.HandleFunc("POST /api/account/login", handleAccountLogin)
mux.HandleFunc("GET /api/account/logout", handleAccountLogout)

// game
mux.HandleFunc("GET /api/game/playercount", handleGamePlayerCount)
mux.HandleFunc("GET /api/game/titlestats", handleGameTitleStats)
mux.HandleFunc("GET /api/game/classicsessioncount", handleGameClassicSessionCount)

// savedata
mux.HandleFunc("GET /api/savedata/get", handleSaveData)
mux.HandleFunc("POST /api/savedata/update", handleSaveData)
mux.HandleFunc("GET /api/savedata/delete", handleSaveData)
mux.HandleFunc("POST /api/savedata/clear", handleSaveData)

// daily
mux.HandleFunc("GET /api/daily/seed", handleDailySeed)
mux.HandleFunc("GET /api/daily/rankings", handleDailyRankings)
mux.HandleFunc("GET /api/daily/rankingpagecount", handleDailyRankingPageCount)
}

func getUsernameFromRequest(r *http.Request) (string, error) {
Expand Down
Loading

0 comments on commit 6bd7deb

Please sign in to comment.