knowyt/server/src/application/syncHandler.go

20 lines
352 B
Go
Raw Normal View History

2021-08-04 23:42:21 +00:00
package application
import (
"fmt"
"net/http"
)
func (app *Application) SyncHandler(w http.ResponseWriter, r *http.Request) {
gameRef := r.URL.Query().Get("g")
gm, err := app.GetGameById(gameRef)
if err != nil {
w.WriteHeader(http.StatusNotFound)
fmt.Fprintf(w, "game not found")
return
}
eng := gm.GetEngine()
eng.SyncHandler(w, r)
}