摘要: 1. 路由组 在实际的项目开发中,均是模块化开发 同一模块内的功能接口,往往会有相同的接口前缀,这种可以用路由组来进行分类处理。 比如下面这几组接口: 注册:http: //localhost:8080/user/register 登陆:http: //localhost:8080/user/log 阅读全文
posted @ 2022-03-30 16:41 aganippe 阅读(696) 评论(0) 推荐(0) 编辑
摘要: 1. 实体绑定 以一个用户注册功能来进行表单实体绑定操作 用户注册需要提交表单数据,假设注册时表单数据包含三项: username phone password 我们创建一个UserRegister结构体用于接收表单数据,通过tag标签的方式设置每个字段对应的form表单中的属性名,通过bindin 阅读全文
posted @ 2022-03-30 15:03 aganippe 阅读(965) 评论(0) 推荐(0) 编辑
摘要: 1. hello world 首先拉取gin开发框架 go get -u github.com /gin-gonic/gin 我们从入门的hello world入手看起gin是如何构建一个http服务器的 package main import "github.com/gin-gonic/gin" 阅读全文
posted @ 2022-03-30 15:03 aganippe 阅读(2108) 评论(0) 推荐(0) 编辑