Fixed CORS-SHIT
This commit is contained in:
parent
e70a414b44
commit
a5a5cdb84a
|
@ -37,10 +37,6 @@ func RegisterRoutes(e *echo.Echo) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// CORS
|
|
||||||
e.OPTIONS("/login", SetCORSHeader)
|
|
||||||
e.OPTIONS("/api/v1/books", SetCORSHeader)
|
|
||||||
|
|
||||||
// Basic Route
|
// Basic Route
|
||||||
e.Static("/", "assets/index.html")
|
e.Static("/", "assets/index.html")
|
||||||
|
|
||||||
|
@ -50,8 +46,16 @@ func RegisterRoutes(e *echo.Echo) {
|
||||||
// API Routes
|
// API Routes
|
||||||
a := e.Group("/api/v1")
|
a := e.Group("/api/v1")
|
||||||
|
|
||||||
a.POST("/login", Login)
|
// CORS_SHIT
|
||||||
|
a.OPTIONS("/books", SetCORSHeader)
|
||||||
|
a.OPTIONS("/books/:id", SetCORSHeader)
|
||||||
a.OPTIONS("/login", SetCORSHeader)
|
a.OPTIONS("/login", SetCORSHeader)
|
||||||
|
a.OPTIONS("/authors", SetCORSHeader)
|
||||||
|
a.OPTIONS("/authors/:id", SetCORSHeader)
|
||||||
|
a.OPTIONS("/publishers", SetCORSHeader)
|
||||||
|
a.OPTIONS("/publishers/:id", SetCORSHeader)
|
||||||
|
|
||||||
|
a.POST("/login", Login)
|
||||||
|
|
||||||
// Lookup Books
|
// Lookup Books
|
||||||
a.GET("/books", apiv1.BookList)
|
a.GET("/books", apiv1.BookList)
|
||||||
|
@ -76,22 +80,16 @@ func RegisterRoutes(e *echo.Echo) {
|
||||||
// Manage Books
|
// Manage Books
|
||||||
a.PUT("/books", apiv1.BookAdd)
|
a.PUT("/books", apiv1.BookAdd)
|
||||||
a.DELETE("/books/:id", apiv1.BookDelete)
|
a.DELETE("/books/:id", apiv1.BookDelete)
|
||||||
a.OPTIONS("/books", SetCORSHeader)
|
|
||||||
a.OPTIONS("/books/:id", SetCORSHeader)
|
|
||||||
|
|
||||||
// Manage Authors
|
// Manage Authors
|
||||||
a.PUT("/authors", apiv1.AuthorAdd)
|
a.PUT("/authors", apiv1.AuthorAdd)
|
||||||
a.DELETE("/authors/:id", apiv1.AuthorDelete)
|
a.DELETE("/authors/:id", apiv1.AuthorDelete)
|
||||||
a.POST("/authors/:id", apiv1.AuthorUpdate)
|
a.POST("/authors/:id", apiv1.AuthorUpdate)
|
||||||
a.OPTIONS("/authors", SetCORSHeader)
|
|
||||||
a.OPTIONS("/authors/:id", SetCORSHeader)
|
|
||||||
|
|
||||||
// Manage Publishers
|
// Manage Publishers
|
||||||
a.PUT("/publishers", apiv1.PublisherAdd)
|
a.PUT("/publishers", apiv1.PublisherAdd)
|
||||||
a.DELETE("/publishers/:id", apiv1.PublisherDelete)
|
a.DELETE("/publishers/:id", apiv1.PublisherDelete)
|
||||||
a.POST("/publishers/:id", apiv1.PublisherUpdate)
|
a.POST("/publishers/:id", apiv1.PublisherUpdate)
|
||||||
a.OPTIONS("/publishers", SetCORSHeader)
|
|
||||||
a.OPTIONS("/publishers/:id", SetCORSHeader)
|
|
||||||
|
|
||||||
// Manage Users
|
// Manage Users
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue