Test cors change (#40)

Reviewed-on: #40
This commit was merged in pull request #40.
This commit is contained in:
2025-05-14 15:44:44 +02:00
parent 4355e1b1b7
commit cc817ed061
3 changed files with 13 additions and 8 deletions

View File

@@ -11,6 +11,7 @@ import (
"os"
"strconv"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
)
@@ -353,6 +354,7 @@ func start(ctx context.Context, config *ServerConfig) {
defer db.db.MustClose()
router := gin.Default()
router.Use(cors.Default())
router.GET("/api/users", getUsers)
router.GET("/api/user/:userId", getUser)
router.POST("/api/user/:userId/allowance", postAllowance)
@@ -396,6 +398,7 @@ func start(ctx context.Context, config *ServerConfig) {
func main() {
config := ServerConfig{
Datasource: os.Getenv("DB_PATH"),
Addr: ":8080",
}
start(context.Background(), &config)
}