1 Star 0 Fork 0

fengzhitalker / iris

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README_ZH.md 13.12 KB
一键复制 编辑 原始数据 按行查看 历史
Gerasimos (Makis) Maropoulos 提交于 2019-01-11 02:10 . push version 11.1.1

Iris Web Framework

build status report card vscode-iris chat view examples release

Iris 是一款超快、简洁高效的 Go 语言 Web开发框架。

Iris 功能强大、使用简单,它将会是你下一个网站、API 服务或者分布式应用基础框架的不二之选。

总之,是一款与 express.js 旗鼓相当的 Go 语言框架。

看看别人是如何评价 Iris,同时欢迎各位点亮 Iris Star,或者关注 Iris facebook 主页

支持者

感谢所有的支持者! 🙏 支持我们

$ cat example.go
package main

import "github.com/kataras/iris"

func main() {
    app := iris.New()
    // 从 "./views" 目录加载HTML模板
    // 模板解析 html 后缀文件
    // 此方式使用 `html/template` 标准包 (Iris 的模板引擎)
    app.RegisterView(iris.HTML("./views", ".html"))

    // 方法:GET
    // 路径:http://localhost:8080
    app.Get("/", func(ctx iris.Context) {
        // {{.message}} 和 "Hello world!" 字符串变量绑定
        ctx.ViewData("message", "Hello world!")
        // 映射 HTML 模板文件路径 ./views/hello.html
        ctx.View("hello.html")
    })

    //方法:GET
    //路径:http://localhost:8080/user/42
    //
    // 使用正则表达式必须设置参数类型为 string
    // app.Get("/user/{id:string regexp(^[0-9]+$)}")
    app.Get("/user/{id:long}", func(ctx iris.Context) {
        userID, _ := ctx.Params().GetInt64("id")
        ctx.Writef("User ID: %d", userID)
    })

    // 绑定端口并启动服务.
    app.Run(iris.Addr(":8080"))
}

想要了解更多关于路径参数配置,戳这里

<!-- file: ./views/hello.html -->
<html>
<head>
    <title>Hello Page</title>
</head>
<body>
    <h1>{{.message}}</h1>
</body>
</html>
$ go run example.go
Now listening on: http://localhost:8080
Application Started. Press CTRL+C to shut down.
_

安装

请确保安装 Go Programming Language

$ go get -u github.com/kataras/iris

Iris 使用 vendor 包依赖管理方式。vendor 包管理的方式可以有效处理包依赖更新问题

Iris vs .NET Core(C#) vs Node.js (Express)

更新于: 2017年11月21日星期二

来自第三方的其他网络框架的基准测试

Comparison with other frameworks

支持

如何贡献代码

贡献者列表

学习

首先,从 Web 框架开始的最正确的方法是学习 Golang 标准库 net/http 的基础知识,如果您的 web 应用程序是一个非常简单的个人项目,没有性能和可维护性要求,您可能只需使用标准库即可。 之后,遵循以下指导原则:

Iris 入门

  1. snowlyg/IrisApiProject: Iris + gorm + jwt + sqlite3 NEW-Chinese
  2. yz124/superstar: Iris + xorm to implement the star library NEW-Chinese
  3. jebzmos4/Iris-golang: A basic CRUD API in golang with Iris
  4. gauravtiwari/go_iris_app: A basic web app built in Iris for Go
  5. A mini social-network created with the awesome Iris💖💖
  6. Iris isomorphic react/hot reloadable/redux/css-modules starter kit
  7. ionutvilie/react-ts: Demo project with react using typescript and Iris
  8. Self-hosted Localization Management Platform built with Iris and Angular
  9. Iris + Docker and Kubernetes
  10. nanobox.io: Quickstart for Iris with Nanobox
  11. hasura.io: A Hasura starter project with a ready to deploy Golang hello-world web app with IRIS

如果你有类似的使用经验吗 请提交给我们!

中间件

Iris 拥有大量的中间件 [1][2] 供您的 Web 应用程序使用。 不过,您并不局限于此,您可以自由使用与 net/http 包兼容的任何第三方中间件,相关示例 _examples/convert-handlers

相关文章(英文)

视频教程(英文) - Youtube

工作机会

有很多公司都在寻找具有 Iris 经验的 Go 网站开发者,我们通过 facebook page 发布这些招聘信息。

授权协议

Iris 授权基于 3-Clause BSD License. Iris 是 100% 免费和开源软件。

有关授权的任何问题,请发送电子邮件

Go
1
https://gitee.com/fengzhitalker/iris.git
git@gitee.com:fengzhitalker/iris.git
fengzhitalker
iris
iris
master

搜索帮助