24 lines
442 B
Go
24 lines
442 B
Go
![]() |
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"net/http"
|
||
|
|
||
|
"github.com/gin-gonic/gin"
|
||
|
)
|
||
|
|
||
|
func postDrinks(c *gin.Context) {
|
||
|
if err := c.BindJSON(&postResult); err != nil {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
c.IndentedJSON(http.StatusCreated, postResult)
|
||
|
fmt.Println("Name:", postResult.Name)
|
||
|
fmt.Println("Comment:", postResult.Comment)
|
||
|
fmt.Println("Timestamp:", postResult.Timestamp)
|
||
|
fmt.Println("Inventory:")
|
||
|
for _, d := range postResult.Inventory {
|
||
|
fmt.Println(d)
|
||
|
}
|
||
|
}
|