Interactive/pkg/internal/server/api/index.go

49 lines
1.3 KiB
Go
Raw Normal View History

package api
import (
"github.com/gofiber/fiber/v2"
)
func MapAPIs(app *fiber.App, baseURL string) {
api := app.Group(baseURL).Name("API")
{
api.Get("/users/me", getUserinfo)
2024-07-25 14:45:31 +00:00
api.Get("/users/:account", getOthersInfo)
2024-07-25 14:58:47 +00:00
api.Get("/users/:account/pin", listOthersPinnedPost)
2024-07-23 08:12:19 +00:00
recommendations := api.Group("/recommendations").Name("Recommendations API")
{
recommendations.Get("/", listRecommendationDefault)
recommendations.Get("/shuffle", listRecommendationShuffle)
}
stories := api.Group("/stories").Name("Story API")
{
stories.Post("/", createStory)
stories.Put("/:postId", editStory)
}
articles := api.Group("/articles").Name("Article API")
{
articles.Post("/", createArticle)
2024-07-23 10:05:54 +00:00
articles.Put("/:postId", editArticle)
}
posts := api.Group("/posts").Name("Posts API")
{
posts.Get("/", listPost)
2024-07-22 05:41:35 +00:00
posts.Get("/drafts", listDraftPost)
posts.Get("/:postId", getPost)
posts.Post("/:postId/react", reactPost)
2024-07-25 14:45:31 +00:00
posts.Post("/:postId/pin", pinPost)
posts.Delete("/:postId", deletePost)
posts.Get("/:postId/replies", listPostReplies)
}
api.Get("/categories", listCategories)
api.Post("/categories", newCategory)
api.Put("/categories/:categoryId", editCategory)
api.Delete("/categories/:categoryId", deleteCategory)
}
}