geo-smart-system/main.go

27 lines
690 B
Go
Raw Normal View History

2019-10-19 16:38:38 +00:00
package main
import (
"fmt"
2019-10-19 16:38:38 +00:00
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/go-redis/redis"
2020-01-04 00:44:42 +00:00
"github.com/supanadit/geo-smart-system/system"
2019-10-19 16:38:38 +00:00
)
func main() {
2020-01-04 00:44:42 +00:00
// Create Connection with Tile 38
2019-10-19 16:38:38 +00:00
client := redis.NewClient(&redis.Options{
2020-01-04 00:44:42 +00:00
Addr: system.GetTile38ConnectionAddress(),
2019-10-19 16:38:38 +00:00
})
2020-01-04 00:44:42 +00:00
// Create Gin Engine
2019-10-27 16:34:34 +00:00
r := gin.Default()
r.Use(cors.Default())
2020-01-04 00:44:42 +00:00
// Call Router
system.Router(r, client)
// Run Server
2021-01-03 14:05:51 +00:00
_ = r.Run(fmt.Sprintf(":%s", system.ServerPort))
2020-11-24 05:12:27 +00:00
// _ = r.RunTLS(fmt.Sprintf(":%s", system.ServerPort), "./server.crt", "./server.key")
2021-01-03 14:05:51 +00:00
//err := http.ListenAndServeTLS(fmt.Sprintf(":%s", system.ServerPort), "cert.pem", "key.pem", nil)
2021-01-03 14:06:35 +00:00
//log.Fatal(err)
2019-10-19 16:38:38 +00:00
}