22 lines
462 B
Go
22 lines
462 B
Go
package handlers_api
|
|
|
|
import (
|
|
"CatsOfMastodonBotGo/internal"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type ApiEndpointHandler struct {
|
|
AppContext *internal.AppContext
|
|
}
|
|
|
|
func NewApiEndpointHandler(appContext *internal.AppContext) *ApiEndpointHandler {
|
|
return &ApiEndpointHandler{
|
|
AppContext: appContext,
|
|
}
|
|
}
|
|
|
|
func (appContext *ApiEndpointHandler) GetRandomPost(c *gin.Context) {
|
|
c.JSON(200, gin.H{
|
|
"post": appContext.AppContext.PostService.GetRandomPost(),
|
|
})
|
|
} |