|
|
@ -27,9 +27,9 @@ func main() { |
|
|
|
|
|
|
|
// 创建CORS中间件,配置允许的源等信息
|
|
|
|
c := cors.New(cors.Options{ |
|
|
|
AllowedOrigins: []string{"http://localhost:5173"}, |
|
|
|
AllowedOrigins: []string{"http://192.168.9.*:5173"}, |
|
|
|
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE"}, |
|
|
|
AllowedHeaders: []string{"Content-Type"}, |
|
|
|
AllowedHeaders: []string{"Content-Type, Authorization"}, |
|
|
|
}) |
|
|
|
handler := c.Handler(mux) |
|
|
|
log.Fatal(http.ListenAndServe(":8080", handler)) |
|
|
|