Associate
Background- I've been working in IT for 30 years, I can script until the cows come home. I'm fine with procedural coding. I can even pass data in and out of simple functions and objects. I'm fine with infrastructure as code and I can build a half decent devops pipeline.
But.....I've been looking to create a REST API for an actual business purpose, and Golang with Gin has been suggested. And I'm stuck at square 1 with an example from the Gin documentation.
I get that we're calling a gin method to instantiate a router object "r", and then we're defining a handler for the root endpoint... and r.Run() is keeping the main function running.... but everything past the "/" has flummoxed me... what are we passing to what?!
func main() {
r := gin.Default()
r.GET("/", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"data": "hello world"})
})
r.Run()
}
I've read and re-read the Gin docs, an online Tutorial and a couple of video courses, and all of them gloss over it. The rest of the team keep saying how elegant Gin is.....
Can anyone explain to me, as a non-developer, in simple terms, what is actually going on? I'm feeling old.... and dumb
TIA!
But.....I've been looking to create a REST API for an actual business purpose, and Golang with Gin has been suggested. And I'm stuck at square 1 with an example from the Gin documentation.
I get that we're calling a gin method to instantiate a router object "r", and then we're defining a handler for the root endpoint... and r.Run() is keeping the main function running.... but everything past the "/" has flummoxed me... what are we passing to what?!
func main() {
r := gin.Default()
r.GET("/", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"data": "hello world"})
})
r.Run()
}
I've read and re-read the Gin docs, an online Tutorial and a couple of video courses, and all of them gloss over it. The rest of the team keep saying how elegant Gin is.....
Can anyone explain to me, as a non-developer, in simple terms, what is actually going on? I'm feeling old.... and dumb
TIA!