Save hashed PW. Simplify model update. Bugfixes & improvements. Working user-settings & games.
This commit is contained in:
23
main.go
23
main.go
@@ -1,21 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"InfrantrySkillCalculator/controllers"
|
||||
"InfrantrySkillCalculator/models"
|
||||
"InfrantrySkillCalculator/utils"
|
||||
"InfantrySkillCalculator/controllers"
|
||||
"InfantrySkillCalculator/models"
|
||||
"InfantrySkillCalculator/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gorilla/sessions"
|
||||
_ "github.com/gorilla/sessions"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
var store = sessions.NewCookieStore([]byte("f0q0qew0!)§(ds9713lsda231"))
|
||||
|
||||
const LoginSessionName = "session"
|
||||
|
||||
func main() {
|
||||
//gin.SetMode(gin.ReleaseMode) // uncomment upon release
|
||||
|
||||
@@ -33,7 +28,11 @@ func main() {
|
||||
f, _ := os.OpenFile("isc_rest.log", os.O_RDWR|os.O_APPEND|os.O_CREATE, 0660)
|
||||
utils.GinWriter = io.MultiWriter(f, os.Stdout)
|
||||
router.Use(
|
||||
gin.LoggerWithWriter(utils.GinWriter, "/update"),
|
||||
gin.LoggerWithWriter(utils.GinWriter, "/static"),
|
||||
gin.Recovery(),
|
||||
)
|
||||
protected.Use(
|
||||
gin.LoggerWithWriter(utils.GinWriter),
|
||||
gin.Recovery(),
|
||||
)
|
||||
|
||||
@@ -62,6 +61,12 @@ func main() {
|
||||
protected.PATCH("/player/:id", controllers.UpdatePlayerByID)
|
||||
protected.DELETE("/player/:id", controllers.DeletePlayerByID)
|
||||
|
||||
protected.GET("/game", controllers.GetGames)
|
||||
protected.GET("/game_html", controllers.GetGamesHTML)
|
||||
|
||||
protected.GET("/settings", controllers.GetSettings)
|
||||
protected.PATCH("/settings", controllers.UpdateSettings)
|
||||
|
||||
log.Println("Running on 8000...")
|
||||
log.Fatal(router.Run(":8000"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user