IRIS 是什么?
IRIS 是go语言编写web程序的 开发框架,我之所以最终选择IRIS 因为IRIS 的路由更加灵活,而且IRIS 极为高效
我们一起快速建立一个iris 网站
1、 创建项目 helloworld
mkdir helloworld && cd helloworld
2、采用go mod 管理包
go mod init helloworld
完整代码如下
package main
import "github.com/kataras/iris/v12"
func main() {
app := iris.New()
app.Get("/hello", func(ctx iris.Context) {
ctx.WriteString("hello , every one")
})
app.Run(iris.Addr(":8080"))
}
在浏览器访问http://localhost:8080/hello 显示下面提示,就证明运行成功了
Screen Shot 2020-06-29 at 20.05.50.png