1
0
mirror of https://github.com/mgerb/go-discord-bot synced 2026-01-11 17:42:48 +00:00

back end done for video archiving

This commit is contained in:
2018-08-20 23:37:58 -05:00
parent e593472c84
commit 5a542e0ffb
16 changed files with 272 additions and 125 deletions

View File

@@ -0,0 +1,32 @@
package response
import (
"net/http"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
)
// BadRequest -
func BadRequest(c *gin.Context, message string) {
dataMap := map[string]string{
"data": message,
}
c.JSON(http.StatusBadRequest, dataMap)
}
// TODO: don't return the error on production
// InternalError -
func InternalError(c *gin.Context, err error) {
log.Error(err)
c.JSON(http.StatusInternalServerError, err)
}
// Success -
func Success(c *gin.Context, data interface{}) {
dataMap := map[string]interface{}{
"data": data,
}
c.JSON(http.StatusOK, dataMap)
}