设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 软件追踪 查看内容

Go语言极速web框架IRIS V4.6.0发布

2016-10-16 19:55| 发布者: joejoe0332| 查看: 2445| 评论: 0|原作者: oschina Node.js v6.8.1 (Current) 发布,多个重要更新|来自: oschina

摘要: Go 语言极速 web 框架 IRIS V4.1.1 发布了,更新如下:4.5.2/.3 - 4.6.0This update affects only testers who usediris.Testerat the past.FIX: httptest flags caused by httpexpect which used to help you with ...

Go 语言极速 web 框架 IRIS V4.1.1 发布了,更新如下:

4.5.2/.3 -> 4.6.0

This update affects only testers who used iris.Tester at the past.

  • FIX: httptest flags caused by httpexpect which used to help you with tests inside old funciris.Tester as reported here

  • NEW: iris.ResetDefault() func which resets the default iris instance which is the station for the most part of the public/package API

  • NEW: package httptest with configuration which can be passed per 'tester' instead of iris instance( this is very helpful for testers)

  • CHANGED: All tests are now converted for 'white-box' testing, means that tests now have package named: iris_test instead of iris in the same main directory.

  • CHANGED: iris.Tester moved to httptest.New which lives inside the new/kataras/iris/httptest package, so:

1
2
3
4
5
6
7
8
9
10
11
12
13
import (
    "github.com/kataras/iris"
    "testing"
)
 
func MyTest(t *testing.T) {
    iris.Get("/mypath", func(ctx *iris.Context){
        ctx.Write("my body")
    })
    // with configs: iris.Config.Tester.ExplicitURL/Debug = true
    e:= iris.Tester(t)
    e.GET("/mypath").Expect().Status(iris.StatusOK).Body().Equal("my body")
}

used that instead/new

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import (
    "github.com/kataras/iris/httptest"
    "github.com/kataras/iris"
    "testing"
)
 
func MyTest(t *testing.T) {
    // make sure that you reset your default station if you don't use the form of app := iris.New()
    iris.ResetDefault()
 
    iris.Get("/mypath", func(ctx *iris.Context){
        ctx.Write("my body")
    })
 
    e:= httptest.New(iris.Default, t)
    // with configs: e:= httptest.New(iris.Default, t, httptest.ExplicitURL(true), httptest.Debug(true))
    e.GET("/mypath").Expect().Status(iris.StatusOK).Body().Equal("my body")
}

Finally, some plugins container's additions:

  • NEW: iris.Plugins.Len() func which returns the length of the current activated plugins in the default station

  • NEW: iris.Plugins.Fired("event") int func which returns how much times and from how many plugins a particular event type is fired, event types are: "prelookup", "prebuild", "prelisten", "postlisten", "preclose", "predownload"

  • NEW: iris.Plugins.PreLookupFired() bool func which returns true if PreLookup fired at least one time

  • NEW: iris.Plugins.PreBuildFired() bool func which returns true if PreBuild fired at least one time

  • NEW: iris.Plugins.PreListenFired() bool func which returns true ifPreListen/PreListenParallel fired at least one time

  • NEW: iris.Plugins.PostListenFired() bool func which returns true if PostListen fired at least one time

  • NEW: iris.Plugins.PreCloseFired() bool func which returns true if PreClose fired at least one time

  • NEW: iris.Plugins.PreDownloadFired() bool func which returns true if PreDownload fired at least one time

Golang目前已经发展成为非常广泛使用的开发语言,如果你开发WEB、后台服务、API,都可以用到golang。

原先我们用go来开发基于web的应用时,一般会用到net/http包,然后在代码中处理大量相同的事情,如:路由、鉴权等。

现在通过Iris-Go,可以方便的帮助你来开发基于web的应用。

                Name                Description                Usage
Basicauth Middleware                HTTP Basic authenticationexample 1example 2book section
JWT Middleware                JSON Web Tokensexample book section
Cors Middleware                Cross Origin Resource Sharing W3 specificationhow to use
Secure Middleware                Facilitates some quick security winsexample
I18n Middleware                Simple internationalizationexamplebook section
Recovery Middleware                Safety recover the station from panicexample
Logger Middleware                Logs every requestexamplebook section
Profile Middleware                Http profiling for debuggingexample
Editor Plugin                Alm-tools, a typescript online IDE/Editorbook section
Typescript Plugin                Auto-compile client-side typescript filesbook section
OAuth,OAuth2 Plugin                User Authentication was never be easier, supports >27 providersexamplebook section
Iris control Plugin                Basic (browser-based) control over your Iris stationexamplebook section
                Name                Description                Usage
JSON                JSON Serializer (Default)example 1,example 2book section
JSONP                JSONP Serializer (Default)example 1,example 2book section
XML                XML Serializer (Default)example 1,example 2book section
Markdown                Markdown Serializer (Default)example 1,example 2book section
Text                Text Serializer (Default)example 1book section
Binary Data                Binary Data Serializer (Default)example 1book section
                Name                Description                Usage
HTML/Default Engine                HTML Template Engine (Default)example book section
Django Engine                Django Template Engineexample book section
Pug/Jade Engine                Pug Template Engineexample book section
Handlebars Engine                Handlebars Template Engineexample book section
Amber Engine                Amber Template Engineexample book section
Markdown Engine                Markdown Template Engineexample book section

酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部