freego_api/main.go
2022-03-03 13:28:00 -05:00

22 lines
538 B
Go

package main
import (
"log"
"net/http"
"github.com/gorilla/mux"
)
func main() {
api := NewAPI()
router := mux.NewRouter().StrictSlash(true)
//plot out routes
router.HandleFunc("/game", api.NewGame).Methods("POST")
router.HandleFunc("/game/{id}", api.GetGame).Methods("GET")
router.HandleFunc("/game/{id}/status", api.GetGameStatus).Methods("GET")
router.HandleFunc("/game/{id}/move", nil).Methods("POST")
router.HandleFunc("/game/{id}/move/{movenum}", nil).Methods("GET")
log.Fatal(http.ListenAndServe(":1379", router))
}