changes
This commit is contained in:
16
main.go
16
main.go
@@ -5,7 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
|
||||
"main/db"
|
||||
"main/handler"
|
||||
@@ -125,15 +125,17 @@ func main() {
|
||||
|
||||
router.HandleFunc("/register", registerHnadler)
|
||||
router.HandleFunc("/login", loginHandler)
|
||||
|
||||
handler.RegsiterClusterRoute(router)
|
||||
router.HandleFunc("/createcluster", handler.CreateClusterHandler)
|
||||
//handler.RegsiterClusterRoute(router)
|
||||
// Enable CORS
|
||||
c := cors.New(cors.Options{
|
||||
AllowedOrigins: []string{"http://localhost:4200", "*"}, // Angular app's origin
|
||||
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE"},
|
||||
AllowedHeaders: []string{"Content-Type"},
|
||||
AllowedOrigins: []string{"*"}, // Allow all origins
|
||||
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
|
||||
AllowedHeaders: []string{"Content-Type", "Authorization", "X-Requested-With", "Accept", "Origin"},
|
||||
ExposedHeaders: []string{"Content-Length"},
|
||||
AllowCredentials: true,
|
||||
Debug: true, // Enable debug logging
|
||||
})
|
||||
|
||||
log.Fatal(http.ListenAndServe(":8082", c.Handler((router))))
|
||||
http.ListenAndServe("0.0.0.0:8082", c.Handler(router))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user