This commit is contained in:
2022-12-11 01:20:21 -06:00
parent d8a6c8acd1
commit 35bcd8534c
3 changed files with 27 additions and 0 deletions

View File

@@ -1,12 +1,27 @@
package endpoints
import (
"time"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
)
func Run() {
r := gin.Default()
r.Use(cors.New(cors.Config{
AllowOrigins: []string{"http://localhost:4000"},
AllowMethods: []string{"GET", "POST", "DELETE", "PATCH"},
AllowHeaders: []string{"Origin", "Content-Type"},
ExposeHeaders: []string{"Content-Length"},
AllowCredentials: true,
AllowOriginFunc: func(origin string) bool {
return origin == "http://localhost:4000"
},
MaxAge: 12 * time.Hour,
}))
public := r.Group("/")
public.POST("/login", login) //web login