2023-10-23 22:01:09 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-11-07 22:34:57 -05:00
|
|
|
"fmt"
|
|
|
|
"io"
|
2023-10-23 22:01:09 -04:00
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
r := gin.Default()
|
2023-11-07 22:34:57 -05:00
|
|
|
r.POST("/webhook", func(c *gin.Context) {
|
|
|
|
body, err := io.ReadAll(c.Request.Body)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Printf("captured: %s\n", string(body))
|
|
|
|
|
2023-10-23 22:01:09 -04:00
|
|
|
c.JSON(http.StatusOK, gin.H{
|
|
|
|
"message": "pong",
|
|
|
|
})
|
|
|
|
})
|
2023-11-07 22:34:57 -05:00
|
|
|
r.Run("0.0.0.0:8081") // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
|
2023-10-23 22:01:09 -04:00
|
|
|
}
|