We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4a0fc00 commit 6fa1508Copy full SHA for 6fa1508
go/server_magic.go
@@ -11,6 +11,7 @@ import (
11
"sync"
12
13
"github.com/gin-gonic/gin"
14
+ "github.com/gin-contrib/cors"
15
"github.com/joho/godotenv"
16
_ "github.com/mattn/go-sqlite3"
17
"github.com/metrico/pasticca/paste"
@@ -49,6 +50,17 @@ func main() {
49
50
51
router := gin.Default()
52
53
+ // CORS configuration
54
+ config := cors.Config{
55
+ AllowOrigins: []string{"*"},
56
+ AllowMethods: []string{"GET", "HEAD"},
57
+ AllowHeaders: []string{"*"},
58
+ ExposeHeaders: []string{},
59
+ MaxAge: 3000,
60
+ }
61
+
62
+ router.Use(cors.New(config))
63
64
router.GET("/*path", server.handleRequest)
65
router.HEAD("/*path", server.handleRequest)
66
router.POST("/*path", server.handlePostRequest)
0 commit comments