✨ Publisher api
This commit is contained in:
@ -11,6 +11,8 @@ func MapAPIs(app *fiber.App, baseURL string) {
|
||||
api.Get("/users/:account", getOthersInfo)
|
||||
api.Get("/users/:account/pin", listOthersPinnedPost)
|
||||
|
||||
api.Get("/publishers/:name", getPublisher)
|
||||
|
||||
recommendations := api.Group("/recommendations").Name("Recommendations API")
|
||||
{
|
||||
recommendations.Get("/", listRecommendationNews)
|
||||
|
15
pkg/internal/server/api/publishers_api.go
Normal file
15
pkg/internal/server/api/publishers_api.go
Normal file
@ -0,0 +1,15 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"git.solsynth.dev/hydrogen/interactive/pkg/internal/services"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func getPublisher(c *fiber.Ctx) error {
|
||||
alias := c.Params("name")
|
||||
if out, err := services.GetPublisher(alias); err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
} else {
|
||||
return c.JSON(out)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user