Update Backend

This commit is contained in:
2026-01-31 00:09:40 +01:00
parent 7df2651208
commit 325d160a45
3 changed files with 14 additions and 0 deletions

View File

@@ -6,12 +6,22 @@ import (
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/go-chi/cors"
)
func main() {
db := InitDB("./dashboard.db")
r := chi.NewRouter()
r.Use(cors.Handler(cors.Options{
AllowedOrigins: []string{"http://localhost:4200"},
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"},
ExposedHeaders: []string{"Link"},
AllowCredentials: true,
MaxAge: 300, // Maximum value not ignored by any major browsers
}))
r.Use(middleware.Logger)
r.Use(middleware.Recoverer)