<commit_before>package main

import (
	"os"
	"runtime"

	"github.com/asm-products/landline-api/handlers"
	"github.com/gin-gonic/gin"
	"github.com/tommy351/gin-cors"
)

func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())
	router := gin.Default()
	router.Use(cors.Middleware(cors.Options{
		AllowMethods: []string{"GET", "OPTIONS"},
	  AllowOrigins: []string{"*"},
	}))

	// Unauthenticated routes
	router.GET("/sessions/new", handlers.SessionsNew)
	router.GET("/sessions/sso", handlers.SessionsLoginSSO)
	router.POST("/teams", handlers.TeamsCreate)
	router.POST("/teams/:slug", handlers.TeamsLogin)
	router.OPTIONS("/*cors", func (c *gin.Context) {
    c.JSON(200, gin.H{"ok": "ok"})
	})

	// authenticated routes
	a := router.Group("/")
	a.Use(cors.Middleware(cors.Options{
		AllowMethods: []string{"GET", "OPTIONS"},
	  AllowOrigins: []string{"*"},
	}))
	a.Use(handlers.Auth(os.Getenv("SECRET")))
	a.GET("users/find", handlers.UsersFindOne)

	// session-keeping for landline.io
	t := router.Group("/teams/:slug")
	t.Use(cors.Middleware(cors.Options{
		AllowMethods: []string{"GET", "OPTIONS"},
	  AllowOrigins: []string{"*"},
	}))
	t.Use(handlers.TeamAuth(os.Getenv("SECRET")))
	t.GET("/", handlers.TeamsShow)
	t.PUT("/", handlers.TeamsUpdate)

	// we don't need the team because we
	// know it from the user
	r := a.Group("/rooms")
	r.Use(cors.Middleware(cors.Options{
		AllowMethods: []string{"GET", "OPTIONS"},
	  AllowOrigins: []string{"*"},
	}))
	r.GET("/", handlers.RoomsIndex)
	r.POST("/", handlers.RoomsCreate)
	// return most recent messages and users
	r.GET("/:room", handlers.RoomsShow)
	r.GET("/:room/messages", handlers.MessagesIndex)
	r.POST("/:room/messages", handlers.MessagesCreate)

	port := os.Getenv("PORT")
	if len(port) == 0 {
		port = "3000"
	}

	router.Run(":" + port)
}
<commit_msg>Try out different CORS options<commit_after>package main

import (
	"os"
	"runtime"

	"github.com/asm-products/landline-api/handlers"
	"github.com/gin-gonic/gin"
	"github.com/tommy351/gin-cors"
)

func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())
	router := gin.Default()
	router.Use(cors.Middleware(cors.Options{
		AllowCredentials: true,
		AllowMethods: []string{"GET", "OPTIONS", "POST"},
	  AllowOrigins: []string{"*"},
	}))

	// Unauthenticated routes
	router.GET("/sessions/new", handlers.SessionsNew)
	router.GET("/sessions/sso", handlers.SessionsLoginSSO)
	router.POST("/teams", handlers.TeamsCreate)
	router.POST("/teams/:slug", handlers.TeamsLogin)
	router.OPTIONS("/*cors", func (c *gin.Context) {
    c.JSON(200, gin.H{"ok": "ok"})
	})

	// authenticated routes
	a := router.Group("/")
	a.Use(handlers.Auth(os.Getenv("SECRET")))
	a.GET("users/find", handlers.UsersFindOne)

	// session-keeping for landline.io
	t := router.Group("/teams/:slug")
	t.Use(handlers.TeamAuth(os.Getenv("SECRET")))
	t.GET("/", handlers.TeamsShow)
	t.PUT("/", handlers.TeamsUpdate)

	// we don't need the team because we
	// know it from the user
	r := a.Group("/rooms")
	r.GET("/", handlers.RoomsIndex)
	r.POST("/", handlers.RoomsCreate)
	// return most recent messages and users
	r.GET("/:room", handlers.RoomsShow)
	r.GET("/:room/messages", handlers.MessagesIndex)
	r.POST("/:room/messages", handlers.MessagesCreate)

	port := os.Getenv("PORT")
	if len(port) == 0 {
		port = "3000"
	}

	router.Run(":" + port)
}

{'fraction_non_alphanumeric': 0.2028373075762149, 'fraction_numerical': 0.006640507093268941, 'mean_word_length': 4.55108877721943, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4237300', 'n_tokens_mistral': 1316, 'n_tokens_neox': 1252, 'n_words': 209}