I have a Lambda function which uses Gin and has two routes created:
func setupRouter() *gin.Engine {
r := gin.Default()
r.GET("/", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"message": "/ hello test completed successfully"})
})
r.GET("/hello-world", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"message": "/hello-world hello test completed successfully"})
})
return r
}
func main() {
log.Fatal(gateway.ListenAndServe(":8080", setupRouter()))
}
When I follow this tutorial and manually create a REST API from the AWS console and attach it to this Lambda these two routes work fine, however what I automate the process through the Serverless Framework it doesn't work. I've tried setting up both an HTTP API and REST API with Serverless but neither worked.
I've looked around a lot for the past couple hours and even found this post suggesting that it's doable, but for some reason I can't get it work.
What configuration am I missing?