package main
import (
"github.com/gin-gonic/gin"
"net/http"
)
type Student struct {
Name string
Age int
}
func main() {
app := gin.Default()
app.Handle("GET", "/", func(context *gin.Context) {
var student Student
student.Name = "王二狗"
student.Age = 18
context.JSON(http.StatusOK, &student)
})
app.Run()
}
网友评论