first commit of files
This commit is contained in:
25
server/jsonRequest.go
Normal file
25
server/jsonRequest.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"artNet/models"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func (s *Server) JsonRequest(c *gin.Context) {
|
||||
var payload models.JsonData
|
||||
|
||||
if err := c.BindJSON(&payload); err != nil {
|
||||
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(200, gin.H{
|
||||
"name": payload,
|
||||
})
|
||||
return
|
||||
|
||||
}
|
Reference in New Issue
Block a user