28 lines
512 B
Go
28 lines
512 B
Go
package main
|
|
|
|
import (
|
|
// "os"
|
|
// "fmt"
|
|
"net/http"
|
|
"github.com/gin-contrib/cors"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func main() {
|
|
router := gin.Default()
|
|
// port = os.Getenv("API_PORT") || 8912
|
|
router.SetTrustedProxies([]string{"127.0.0.1"}) // TODO: fix
|
|
router.Use(cors.Default()) // All origins allowed by default
|
|
|
|
router.GET("/api/v1/ping", func(c *gin.Context) {
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"message": "pong",
|
|
"status": "ok",
|
|
})
|
|
})
|
|
|
|
if err := router.Run(); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|