1 Star 0 Fork 0

fengzhitalker / iris

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

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% 免费和开源软件。

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

Copyright (c) 2017-2018 The Iris Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Iris nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

The fastest backend community-driven web framework on (THIS) Earth. HTTP/2, MVC and more. Can your favourite web framework do that? 👉 http://bit.ly/iriscandothat1 or even http://bit.ly/iriscandothat2 展开 收起
Go
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/fengzhitalker/iris.git
git@gitee.com:fengzhitalker/iris.git
fengzhitalker
iris
iris
master

搜索帮助