2019-10-19 16:38:38 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2019-12-27 10:26:50 +00:00
|
|
|
"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
|
|
|
|
_ = r.Run(fmt.Sprintf(":%s", system.ServerPort))
|
2019-10-19 16:38:38 +00:00
|
|
|
}
|