I am running a gin router and defined a API like this
versionOneApis.GET(/details, myfunc1("my data") , myfunc2)
My myfunc2 has the following signature
func myfunc2 (c *gin.Context) {
c.Header("Content-Type", "application/json")
c.JSON(http.StatusOK, "my details")
}
I want to pass some data into myfunc2. I am able to pass data into myfunc1 whose signature is
func myfunc1 (somedata string) {
fmt.Println(somedata)
}
But I am not able to pass data into myfunc2 as I cannot pass a *gin.Context and my data together and if I dont pass 2 values then I get an error saying that 2 inputs are required for myfunc2.
How can I pass data to myfunc2 which already has a *gin.Context input paramter?