Annie is writing the back-end code for an e-commerce website: "Hyper Center", which sells electronic and tech products. She wants to create a nested route: /articles/gadgets/smartphones/list to showcase all the smartphones the store sells, but forgot how to properly use the router.Group method to create nested routes.
Your task is to help Annie sort the code in the correct order to create the nested route: /articles/gadgets/smartphones/list.
Below is the code she has written so far:
package main
import (
"github.com/gin-gonic/gin"
"log"
"net/http"
)
func main() {
router := gin.Default()
// The sorted code goes here!
smartphones.GET("/list", func(context *gin.Context) {
context.String(http.StatusOK, "Look at Hyper Center's Smartphone list!")
})
err := router.Run()
if err != nil {
log.Fatal(err)
}
}