24 lines
466 B
Go
24 lines
466 B
Go
package handlers
|
|
|
|
import (
|
|
"CatsOfMastodonBotGo/internal/services"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type ApiEndpointHandler struct {
|
|
PostService services.PostService
|
|
}
|
|
|
|
var ApiEndpointHandlerInstance *ApiEndpointHandler
|
|
|
|
func InitApiEndpointHandler() {
|
|
ApiEndpointHandlerInstance = &ApiEndpointHandler{
|
|
PostService: *services.PostServiceInstance,
|
|
}
|
|
|
|
}
|
|
|
|
func (ps *ApiEndpointHandler) GetRandomPost(c *gin.Context) {
|
|
c.JSON(200,ps.PostService.GetRandomPost())
|
|
} |