83 lines
1.4 KiB
Go
83 lines
1.4 KiB
Go
// Package classification Click 'n' Join ManagementSystem Documentation
|
||
//
|
||
// Schemes: http
|
||
// Host: localhost
|
||
// BasePath: /v1
|
||
// Version: 0.0.1
|
||
//
|
||
// Consumes:
|
||
// - application/json
|
||
//
|
||
// Produces:
|
||
// - application/json
|
||
//
|
||
// swagger:meta
|
||
package main
|
||
|
||
import (
|
||
"clickandjoin.app/managementsystem/modules/config"
|
||
"clickandjoin.app/managementsystem/routers/router"
|
||
"github.com/gofiber/fiber/v2"
|
||
"github.com/gofiber/fiber/v2/middleware/logger"
|
||
"github.com/sirupsen/logrus"
|
||
)
|
||
|
||
func init() {
|
||
config.LoadConfig()
|
||
|
||
if config.Cfg.Debug {
|
||
logrus.SetLevel(logrus.DebugLevel)
|
||
}
|
||
|
||
logrus.Println("Debug:", config.Cfg.Debug)
|
||
}
|
||
|
||
func main() {
|
||
app := fiber.New()
|
||
|
||
cfg := config.Cfg
|
||
|
||
if cfg.Debug {
|
||
app.Use(logger.New(logger.Config{
|
||
Format: "${pid} ${locals:requestid} ${status} - ${method} ${path}\n",
|
||
}))
|
||
}
|
||
|
||
/*
|
||
cache.WebSocketSessions["test"] = []string{"alpha", "test", "testa", "bob", "beta"}
|
||
|
||
logrus.Println(len(cache.WebSocketSessions["test"]))
|
||
|
||
user := cache.WebSocketSessions["test"]
|
||
|
||
for index, item := range user {
|
||
if item == "alpha" {
|
||
user = remove(user, index)
|
||
}
|
||
}
|
||
|
||
logrus.Println("s", cache.WebSocketSessions, len(user)) */
|
||
/*
|
||
t1 := time.NewTicker(3 * time.Second)
|
||
|
||
i := 0
|
||
|
||
go func() {
|
||
for range t1.C {
|
||
i++
|
||
logrus.Println("timer", cache.WebSocketSessions)
|
||
}
|
||
}() */
|
||
|
||
router.SetupRoutes(app)
|
||
|
||
app.Listen(cfg.Host + ":" + cfg.Port)
|
||
}
|
||
|
||
/*
|
||
func remove(s []string, i int) []string {
|
||
s[i] = s[0]
|
||
return s[1:]
|
||
}
|
||
*/
|