micrach/main.go

32 lines
619 B
Go
Raw Normal View History

2021-08-26 16:16:50 +03:00
package main
import (
"log"
"strconv"
"github.com/gin-gonic/gin"
2021-08-26 17:32:19 +03:00
_ "github.com/joho/godotenv/autoload"
2021-08-26 16:16:50 +03:00
Config "micrach/config"
2021-08-26 20:23:55 +03:00
Controllers "micrach/controllers"
2021-08-26 16:16:50 +03:00
Db "micrach/db"
// Utils "micrach/utils"
)
func main() {
Config.Init()
Db.Init()
defer Db.Pool.Close()
gin.SetMode(Config.App.Env)
router := gin.Default()
2021-08-26 20:23:55 +03:00
router.GET("/", Controllers.GetThreads)
router.POST("/", Controllers.CreateThread)
router.GET("/:threadId", Controllers.GetThread)
router.POST("/:threadId", Controllers.UpdateThread)
2021-08-26 16:16:50 +03:00
log.Println("all systems nominal")
router.Run("localhost:" + strconv.Itoa(Config.App.Port))
}