Capstone/service/main.go

27 lines
436 B
Go
Raw Normal View History

2023-10-23 22:01:09 -04:00
package main
import (
"fmt"
"io"
2023-10-23 22:01:09 -04:00
"net/http"
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
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",
})
})
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
}