Skip to content

Commit 5e98418

Browse files
authored
Update main.go
1 parent ec3c221 commit 5e98418

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

cmd/main.go

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
11
package main
2-
2+
33
import (
44
"log"
55
"net/http"
66

7-
"github.com/gorilla/handlers"
8-
"github.com/gorilla/mux"
97
"bullet-cloud-api/internal/handlers"
10-
)
8+
9+
"github.com/gorilla/mux"
10+
)
1111

1212
func main() {
13-
router := mux.NewRouter()
14-
15-
13+
router := mux.NewRouter()
14+
15+
// essa rota deu trabalho, handlers handlers
1616
router.HandleFunc("/products", handlers.GetAllProducts).Methods("GET")
1717
router.HandleFunc("/products", handlers.CreateProduct).Methods("POST")
1818
router.HandleFunc("/products/{id}", handlers.GetProduct).Methods("GET")
1919
router.HandleFunc("/products/{id}", handlers.UpdateProduct).Methods("PUT")
2020
router.HandleFunc("/products/{id}", handlers.DeleteProduct).Methods("DELETE")
21+
//
22+
// checar a saúde do jovem
2123
router.HandleFunc("/health", handlers.HealthCheck).Methods("GET")
2224

23-
corsHandler := handlers.CORS(
24-
handlers.AllowedOrigins([]string{"http://bulletcloud.com", "http://localhost:3000"}), // adicione seus domínios
25-
handlers.AllowedMethods([]string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}),
26-
handlers.AllowedHeaders([]string{"Content-Type", "Authorization"}),
27-
)
28-
29-
handler := corsHandler(router)
30-
3125
log.Println("Server starting on :8080")
32-
log.Fatal(http.ListenAndServe(":8080", handler))
26+
log.Fatal(http.ListenAndServe(":8080", router))
3327
}

0 commit comments

Comments
 (0)