上一页 1 ··· 69 70 71 72 73 74 75 76 77 ··· 234 下一页

2020年5月27日

golang html/template

摘要: template包(html/template)实现了数据驱动的模板,用于生成可对抗代码注入的安全HTML输出。本包提供了和text/template包相同的接口,无论何时当输出是HTML的时候都应使用本包。 main.go package main import ( "html/template" 阅读全文

posted @ 2020-05-27 11:55 ExplorerMan 阅读(810) 评论(0) 推荐(0)

2020年5月25日

golangWeb框架---github.com/gin-gonic/gin学习八(监听多端口、多类型的struct模型绑定)

摘要: 文章目录监听多端口自定义的struct绑定form-data监听多端口如何利用gin实现监听多端口 package main import ( "log" "net/http" "time" "github.com/gin-gonic/gin" "golang.org/x/sync/errgroup 阅读全文

posted @ 2020-05-25 21:20 ExplorerMan 阅读(480) 评论(0) 推荐(0)

golangWeb框架---github.com/gin-gonic/gin学习七(重定向、中间件Goroutines、http自定义配置)

摘要: 文章目录重定向服务器内部重定向中间件中间件内部的GoroutinesHTTP自定义配置重定向package main import ( "github.com/gin-gonic/gin" "net/http") func main() { router := gin.Default() route 阅读全文

posted @ 2020-05-25 21:15 ExplorerMan 阅读(469) 评论(0) 推荐(0)

golangWeb框架---github.com/gin-gonic/gin学习五(模版渲染、返回数据的格式)

摘要: 文章目录Bind HTML checkboxesMultipart/Urlencoded 绑定XML, JSON, YAML and ProtoBuf renderingjsonxmlyamlProtoBufJSONPAsciiJSONPureJSONBind HTML checkboxes学web 阅读全文

posted @ 2020-05-25 21:09 ExplorerMan 阅读(551) 评论(0) 推荐(0)

golangWeb框架---github.com/gin-gonic/gin学习四(模型绑定、自定义校验、ShouldBindXXX、BindXXX)

摘要: 文章目录模型绑定、校验绑定json(ShouldBindJSON)绑定xml(ShouldBindXML)、form(ShouldBind)自定义校验器(demo有问题)BindQuery\ShouldBindQuery(只限查询参数)BindJson(json)、Bind(查询参数、formdat 阅读全文

posted @ 2020-05-25 21:04 ExplorerMan 阅读(1298) 评论(0) 推荐(0)

golangWeb框架---github.com/gin-gonic/gin学习三(路由多视图函数、中间件、log日志)

摘要: 文章目录gin.New路由包含多个HandlerFunc函数使用中间件如何写log日志gin.New我们之前的例子都是利用了gin.Default(),那么gin.New()跟它有什么区别?来简单看下源码gin.Default()源码如下 func Default() *Engine { debug 阅读全文

posted @ 2020-05-25 21:01 ExplorerMan 阅读(325) 评论(0) 推荐(0)

golangWeb框架---github.com/gin-gonic/gin学习二(文件上传、多文件上传)

摘要: 文章目录上传单个文件(一)上传单个文件(二)上传多个文件 关于如何实现Gin框架上传单个文件、多个文件的案例上传单个文件(一)package main import ( "github.com/gin-gonic/gin" "io" "log" "net/http" "os") func main( 阅读全文

posted @ 2020-05-25 21:00 ExplorerMan 阅读(346) 评论(0) 推荐(0)

golangWeb框架---github.com/gin-gonic/gin学习一(路由、多级路由、参数传递几种形式)

摘要: 文章目录 Gin介绍 安装 快速开始 路径参数 构造参数 post传参 get+post混合形式 构造Map格式 分组路由 Gin介绍 Gin是一个golang的微框架,封装比较优雅,API友好,源码注释比较明确,已经发布了1.0版本。具有快速灵活,容错方便等特点。其实对于golang而言,web框 阅读全文

posted @ 2020-05-25 20:59 ExplorerMan 阅读(1488) 评论(0) 推荐(0)

go中gin框架+realize实现边写代码边编译,热更新

摘要: 最近看到了热加载,相关的,就搜索了goland实现热加载 发现了一个插件realize https://github.com/oxequa/realize 然后,为了自己撸代码更方便,配合gin写个教程 1.准备 go get github.com/oxequa/realizego get gith 阅读全文

posted @ 2020-05-25 18:20 ExplorerMan 阅读(1349) 评论(0) 推荐(0)

golang框架对比Revel and Beego

摘要: 1 框架背景1.1 RevelRevel是Google官方发布的一款go语言web框架,其具有热编译,高性能,无状态,模块化等特性,非常适合做web开发。在GitHub上有10.7k颗star,124个贡献者。 1.2 Beegobeego 是一个快速开发 Go 应用的 HTTP 框架,他可以用来快 阅读全文

posted @ 2020-05-25 18:18 ExplorerMan 阅读(1615) 评论(0) 推荐(0)

上一页 1 ··· 69 70 71 72 73 74 75 76 77 ··· 234 下一页

导航