Go
go
zhanghe_zht
这个作者很懒,什么都没留下…
展开
-
echo简单实现Go web服务器
package mainimport ( "github.com/labstack/echo/v4" "net/http")func main() { // Echo instance e := echo.New() // Routes e.GET("/", hello) e.GET("/ping", func(c echo.Context) error { retu...原创 2020-04-21 15:44:23 · 518 阅读 · 0 评论 -
Gin简单实现Go web服务器
package mainimport ( "github.com/gin-gonic/gin")func main(){ // 注册一个默认的路由器 router := gin.Default() // get请求 router.GET("/", func (c *gin.Context) { c.String(200,"hello gin") }) router....原创 2020-04-21 15:12:26 · 499 阅读 · 0 评论 -
Iris简单实现Go web服务器
package mainimport ( "github.com/kataras/iris")func main() { app := iris.New() // 实例一个iris对象 //配置路由 app.Get("/", func(ctx iris.Context) { ctx.WriteString("Hello Iris") }) app.Get("/aa"...原创 2020-04-21 14:58:31 · 569 阅读 · 0 评论 -
GoLand 使用Go Modules建立一个Iris项目
新建一个go mod项目,填写proxy新建go文件import “github.com/kataras/iris”红色没关系,直接运行,系统自动帮忙下载需要的go包代码:package mainimport “fmt”import “github.com/kataras/iris”func main() {fmt.Print(“aa”)app:=iris.New...原创 2020-04-20 21:42:50 · 1866 阅读 · 0 评论