Comment, list all saves, set port, set hash

This commit is contained in:
Aurélie Delhaie
2022-05-24 23:49:47 +02:00
parent e3c2068ae9
commit 87957cb2d5
6 changed files with 100 additions and 74 deletions

View File

@@ -3,6 +3,7 @@ package server
import (
"context"
"errors"
"fmt"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"log"
@@ -37,6 +38,7 @@ func Serve() {
r.Route("/game", func(secureRouter chi.Router) {
secureRouter.Use(authMiddleware)
secureRouter.Post("/create", CreateGame)
secureRouter.Get("/all", AllGamesInformation)
secureRouter.Get("/info/{id}", GameInfoByID)
secureRouter.Post("/upload/init", AskForUpload)
secureRouter.Group(func(uploadRouter chi.Router) {
@@ -49,7 +51,7 @@ func Serve() {
})
})
log.Println("Server is listening...")
err := http.ListenAndServe(":8080", router)
err := http.ListenAndServe(fmt.Sprintf(":%d", config.Server().Port), router)
if err != nil {
log.Fatal(err)
}