Skip to content

Instantly share code, notes, and snippets.

@nidhi-canopas
Last active July 19, 2022 07:19
Show Gist options
  • Select an option

  • Save nidhi-canopas/f7f05d73881599b139eeef3c8815bab8 to your computer and use it in GitHub Desktop.

Select an option

Save nidhi-canopas/f7f05d73881599b139eeef3c8815bab8 to your computer and use it in GitHub Desktop.
func HelloWorld(c *gin.Context) {
text := c.DefaultQuery("txt", "Hey Go dev!!")
c.JSON(http.StatusOK, gin.H{"greeting": text})
}
// endpoint
r.GET("/hello", HelloWorld)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment