20 lines
352 B
Go
20 lines
352 B
Go
|
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)
|
||
|
}
|