chore: init
This commit is contained in:
27
api/main.go
Normal file
27
api/main.go
Normal file
@@ -0,0 +1,27 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user