Onama is a pure backend API server written in Fiber a Golang module that mocks the style of Express.js
First of all, download and install Go. 1.12
or higher is required.
Clone the repository to your local machine:
git clone https://github.com/UCMercedACM/Tenaya
Install all the necessary packages:
go install
/api
--> assigns all headers for routes under API route
📜 Show code snippet
app.Use("/api", func(c *fiber.Ctx) {
c.Set("Access-Control-Allow-Origin", "*")
c.Set("Access-Control-Allow-Headers", "X-Requested-With")
c.Set("Content-Type", "application/json")
c.Next()
})
/api/events
--> all calendar events
📜 Show code snippet
app.Get("/api/events", func(c *fiber.Ctx) { ... })
/api/events/:type
--> return only a subgroup of all events
📜 Show code snippet
app.Get("/api/events/:type", func(c *fiber.Ctx) { ... })
/api/event/:id
--> returns specific event
📜 Show code snippet
app.Get("/api/event/:id", func(c *fiber.Ctx) { ... })
/api/events
--> create multiple new events
📜 Show code snippet
app.Post("/api/events", func(c *fiber.Ctx) { ... })
/api/event
--> create a single new event
📜 Show code snippet
app.Post("/api/event", func(c *fiber.Ctx) { ... })
/api/events
--> update the data of all events at once
📜 Show code snippet
app.Patch("/api/events", func(c *fiber.Ctx) { ... })
/api/events/:type
--> update all the events of a single type
📜 Show code snippet
app.Patch("/api/events/:type", func(c *fiber.Ctx) { ... })
/api/event/:id
--> update a single event
📜 Show code snippet
app.Patch("/api/event/:id", func(c *fiber.Ctx) { ... })
/api/events
--> completely delete all events
📜 Show code snippet
app.Delete("/api/events", func(c *fiber.Ctx) { ... })
/api/events/:type
--> deletes all events under a specific type
📜 Show code snippet
app.Delete("/api/events/:type", func(c *fiber.Ctx) { ... })
/api/event/:id
--> delete a specific event
📜 Show code snippet
app.Delete("/api/event/:id", func(c *fiber.Ctx) { ... })
*
--> handles all unknown routes
📜 Show code snippet
app.Get("*", func(c *fiber.Ctx) {
c.Status(404).Send("Unknown Request")
})