Skip to content

Commit

Permalink
Merge pull request #9 from durgeshmeena/galactic_go
Browse files Browse the repository at this point in the history
add items endpoint
  • Loading branch information
durgeshmeena authored Sep 28, 2024
2 parents 8ed034d + 3de5a4b commit 69d6fdb
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
func main() {
router := gin.Default()
router.GET("/", greet)
router.GET("/items", getItems)
router.HEAD("/healthcheck", healthcheck)

router.Run()
Expand All @@ -22,3 +23,32 @@ func healthcheck(c *gin.Context) {
"status": "ok",
})
}


func getItems(c *gin.Context) {

data := []gin.H{
{
"id": 1,
"name": "Galactic Goggles",
},
{
"id": 2,
"name": "Meteor Muffins",
},
{
"id": 3,
"name": "Alien Antenna Kit",
},
{
"id": 4,
"name": "Starlight Lantern",
},
{
"id": 5,
"name": "Quantum Quill",
},
}

c.IndentedJSON(http.StatusOK, data)
}

0 comments on commit 69d6fdb

Please sign in to comment.