Skip to content

Commit

Permalink
Update to version 12.1.6
Browse files Browse the repository at this point in the history
Former-commit-id: 4d39e8a764a7c0d91b19a3710d8afe6c8c208c62
  • Loading branch information
kataras committed Feb 5, 2020
1 parent d4e38da commit 9c97a8a
Show file tree
Hide file tree
Showing 14 changed files with 145 additions and 120 deletions.
7 changes: 7 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ Developers are not forced to upgrade if they don't really need it. Upgrade whene

**How to upgrade**: Open your command-line and execute this command: `go get github.com/kataras/iris/v12@latest`.

# We, 05 February 2020 | v12.1.6

Fixes:

- [jet.View - urlpath error](https://github.com/kataras/iris/issues/1438)
- [Context.ServeFile send 'application/wasm' with a wrong extra field](https://github.com/kataras/iris/issues/1440)

# Su, 02 February 2020 | v12.1.5

Various improvements and linting.
Expand Down
4 changes: 2 additions & 2 deletions HISTORY_ES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ Los desarrolladores no están obligados a actualizar si realmente no lo necesita

**Cómo actualizar**: Abra su línea de comandos y ejecute este comando: `go get github.com/kataras/iris/v12@latest`.

# Su, 02 February 2020 | v12.1.5
# We, 05 February 2020 | v12.1.6

Not translated yet, please navigate to the [english version](HISTORY.md#su-02-february-2020--v1215) instead.
Not translated yet, please navigate to the [english version](HISTORY.md#we-05-february-2020--v1216) instead.

# Sábado, 26 de octubre 2019 | v12.0.0

Expand Down
3 changes: 3 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ Revision ID: 607b5b7cef034da2692f99a4c9bafb31a999ccda
jade 9ffefa50b5f3141 https://github.com/Joker/jade
6ac643e9d9ad611
6f4688705f
jet 33cfc27b3e00072 github.com/CloudyKit/jet
655fdb3af24c325
3ea5bffb8f
json-iterator 08047c174c6c03e https://github.com/json-iterator/go
8ec963a411bde1b
6d1ee67b26
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# News

![](https://iris-go.com/images/release.png) Iris version **12.1.5** has been [released](HISTORY.md#su-02-february-2020--v1215)!
![](https://iris-go.com/images/release.png) Iris version **12.1.6** has been [released](HISTORY.md#we-05-february-2020--v1216)!

![](https://iris-go.com/images/cli.png) The official [Iris Command Line Interface](https://github.com/kataras/iris-cli) will soon be near you in 2020!

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.1.5:https://github.com/kataras/iris/releases/tag/v12.1.5
12.1.6:https://github.com/kataras/iris/releases/tag/v12.1.6
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ import (
"github.com/kataras/iris/v12"
)

// $ go get github.com/valyala/tcplisten
// $ go run main.go

// You can run the same app as many times as you want.
func main() {
app := iris.New()

Expand All @@ -35,7 +33,7 @@ func main() {
FastOpen: true,
}

l, err := listenerCfg.NewListener("tcp", ":8080")
l, err := listenerCfg.NewListener("tcp4", ":8080")
if err != nil {
panic(err)
}
Expand Down
17 changes: 7 additions & 10 deletions _examples/view/template_jet_0/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,13 @@ func main() {
ctx.ViewData("showingAllDone", true)
ctx.ViewData("title", "Todos - All Done")

// Key does not actual matter at all here.
// However, you can enable it for better performance.
// In order to enable key mapping for
// jet specific renderer and ranger types
// you have to initialize the View Engine
// with `tmpl.DisableViewDataTypeCheck("_jet")`.
//
// Defaults to type checks, empty key.
ctx.ViewData("_jet", (&doneTODOs{}).New(todos))
ctx.View("todos/index.jet")
// Use ctx.ViewData("_jet", jetData)
// if using as middleware and you want
// to pre-set the value or even change it later on from another next middleware.
// ctx.ViewData("_jet", (&doneTODOs{}).New(todos))
// and ctx.View("todos/index.jet")
// OR
ctx.View("todos/index.jet", (&doneTODOs{}).New(todos))
})

port := os.Getenv("PORT")
Expand Down
2 changes: 1 addition & 1 deletion _examples/view/template_jet_0/views/todos/show.jet
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{{block documentBody()}}
<h1>Show TODO</h1>
<p>This uses a custom renderer by implementing the jet.Renderer interface.
<p>This uses a custom renderer by implementing the jet.Renderer (or view.JetRenderer) interface.
<p>
{{.}}
</p>
Expand Down
66 changes: 66 additions & 0 deletions _examples/view/template_jet_2/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Package main an example on how to naming your routes & use the custom 'url path' Jet Template Engine.
package main

import (
"github.com/kataras/iris/v12"
)

func main() {
app := iris.New()
app.RegisterView(iris.Jet("./views", ".jet").Reload(true))

mypathRoute := app.Get("/mypath", writePathHandler)
mypathRoute.Name = "my-page1"

mypath2Route := app.Get("/mypath2/{paramfirst}/{paramsecond}", writePathHandler)
mypath2Route.Name = "my-page2"

mypath3Route := app.Get("/mypath3/{paramfirst}/statichere/{paramsecond}", writePathHandler)
mypath3Route.Name = "my-page3"

mypath4Route := app.Get("/mypath4/{paramfirst}/statichere/{paramsecond}/{otherparam}/{something:path}", writePathHandler)
// same as: app.Get("/mypath4/:paramfirst/statichere/:paramsecond/:otherparam/*something", writePathHandler)
mypath4Route.Name = "my-page4"

// same with Handle/Func
mypath5Route := app.Handle("GET", "/mypath5/{paramfirst}/statichere/{paramsecond}/{otherparam}/anything/{something:path}", writePathHandler)
mypath5Route.Name = "my-page5"

mypath6Route := app.Get("/mypath6/{paramfirst}/{paramsecond}/statichere/{paramThirdAfterStatic}", writePathHandler)
mypath6Route.Name = "my-page6"

app.Get("/", func(ctx iris.Context) {
// for /mypath6...
paramsAsArray := []string{"theParam1", "theParam2", "paramThirdAfterStatic"}
ctx.ViewData("ParamsAsArray", paramsAsArray)
if err := ctx.View("page.jet"); err != nil {
panic(err)
}
})

app.Get("/redirect/{namedRoute}", func(ctx iris.Context) {
routeName := ctx.Params().Get("namedRoute")
r := app.GetRoute(routeName)
if r == nil {
ctx.StatusCode(iris.StatusNotFound)
ctx.Writef("Route with name %s not found", routeName)
return
}

println("The path of " + routeName + "is: " + r.Path)
// if routeName == "my-page1"
// prints: The path of of my-page1 is: /mypath
// if it's a path which takes named parameters
// then use "r.ResolvePath(paramValuesHere)"
ctx.Redirect(r.Path)
// http://localhost:8080/redirect/my-page1 will redirect to -> http://localhost:8080/mypath
})

// http://localhost:8080
// http://localhost:8080/redirect/my-page1
app.Run(iris.Addr(":8080"))
}

func writePathHandler(ctx iris.Context) {
ctx.Writef("Hello from %s.", ctx.Path())
}
24 changes: 24 additions & 0 deletions _examples/view/template_jet_2/views/page.jet
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<a href="{{urlpath("my-page1")}}">/mypath</a>
<br />
<br/>
<a href="{{urlpath("my-page2","theParam1","theParam2")}}">/mypath2/{paramfirst}/{paramsecond}</a>
<br />
<br />

<a href="{{urlpath("my-page3", "theParam1", "theParam2AfterStatic")}}">/mypath3/{paramfirst}/statichere/{paramsecond}</a>
<br />
<br />

<a href="{{urlpath("my-page4", "theParam1", "theparam2AfterStatic", "otherParam", "matchAnything")}}">
/mypath4/{paramfirst}/statichere/{paramsecond}/{otherparam}/{something:path}</a>
<br />
<br />

<a href="{{urlpath("my-page5", "theParam1", "theParam2Afterstatichere", "otherParam", "matchAnythingAfterStatic")}}">
/mypath5/{paramfirst}/statichere/{paramsecond}/{otherparam}/anything/{anything:path}</a>
<br />
<br />

<a href={{urlpath("my-page6", .ParamsAsArray)}}>
/mypath6/{paramfirst}/{paramsecond}/statichere/{paramThirdAfterStatic}
</a>
2 changes: 1 addition & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Source code and other details for the project are available at GitHub:
Current Version
12.1.5
12.1.6
Installation
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.13

require (
github.com/BurntSushi/toml v0.3.1
github.com/CloudyKit/jet v2.1.3-0.20180809161101-62edd43e4f88+incompatible
github.com/CloudyKit/jet/v3 v3.0.0
github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible
Expand Down
14 changes: 11 additions & 3 deletions iris.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import (
)

// Version is the current version number of the Iris Web Framework.
const Version = "12.1.5"
const Version = "12.1.6"

// HTTP status codes as registered with IANA.
// See: http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml.
Expand Down Expand Up @@ -583,9 +583,17 @@ func (app *Application) NewHost(srv *http.Server) *host.Supervisor {
srv.ErrorLog = log.New(app.logger.Printer.Output, "[HTTP Server] ", 0)
}

if srv.Addr == "" {
srv.Addr = ":8080"
if addr := srv.Addr; addr == "" {
addr = ":8080"
if len(app.Hosts) > 0 {
if v := app.Hosts[0].Server.Addr; v != "" {
addr = v
}
}

srv.Addr = addr
}

app.logger.Debugf("Host: addr is %s", srv.Addr)

// create the new host supervisor
Expand Down
Loading

0 comments on commit 9c97a8a

Please sign in to comment.