mirror of
https://codeberg.org/aryak/mozhi
synced 2025-03-14 21:44:19 +05:30
add cors header for API endpoints (closes #55)
This commit is contained in:
parent
099885f315
commit
8d3855589f
@ -95,6 +95,11 @@ func Serve(port string) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
api := app.Group("/api")
|
api := app.Group("/api")
|
||||||
|
// Set CORS Header for all API endpoints
|
||||||
|
api.Use(func(c *fiber.Ctx) error {
|
||||||
|
c.Set("Access-Control-Allow-Origin", "*")
|
||||||
|
return c.Next()
|
||||||
|
})
|
||||||
api.All("/translate", pages.HandleTranslate)
|
api.All("/translate", pages.HandleTranslate)
|
||||||
api.All("/image", pages.HandleImg)
|
api.All("/image", pages.HandleImg)
|
||||||
api.Get("/source_languages", pages.HandleSourceLanguages)
|
api.Get("/source_languages", pages.HandleSourceLanguages)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user