2021-10-11 06:19:42 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/gin-contrib/cors"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
r := gin.Default()
|
|
|
|
r.Use(cors.New(cors.Config{
|
|
|
|
AllowOrigins: []string{"http://localhost:8080", "http://localhost:5000"},
|
|
|
|
AllowCredentials: true,
|
|
|
|
AllowHeaders: []string{"*"},
|
|
|
|
|
|
|
|
}))
|
|
|
|
r.GET("/ping", func(c *gin.Context) {
|
|
|
|
c.JSON(200, gin.H{
|
2021-10-11 11:23:00 +02:00
|
|
|
"message": "pong",
|
2021-10-11 06:19:42 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
r.Run()
|
|
|
|
}
|