post echo request
This commit is contained in:
parent
00e86f3b06
commit
0b4199c798
14
main.go
14
main.go
@ -1,6 +1,11 @@
|
||||
package main
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func main() {
|
||||
router := gin.Default()
|
||||
@ -9,5 +14,12 @@ func main() {
|
||||
"version": "0.0.1",
|
||||
})
|
||||
})
|
||||
|
||||
router.POST("/echo", func(c *gin.Context) {
|
||||
buf := new(bytes.Buffer)
|
||||
buf.ReadFrom(c.Request.Body)
|
||||
data := buf.String()
|
||||
fmt.Println(data)
|
||||
})
|
||||
router.Run("0.0.0.0:80") // listen and serve on 0.0.0.0:8080
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user