Refactor app structure: move models to domain, centralize config and database init - TODO: add jwt
This commit is contained in:
24
internal/web/handlers/apiEndpoint.go
Normal file
24
internal/web/handlers/apiEndpoint.go
Normal file
@@ -0,0 +1,24 @@
|
||||
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())
|
||||
}
|
Reference in New Issue
Block a user