23 lines
397 B
Go
23 lines
397 B
Go
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{
|
|
"message": "pong",
|
|
})
|
|
})
|
|
|
|
r.Run()
|
|
}
|