update wiki to iris v12.0.0

Gerasimos (Makis) Maropoulos 2019-10-26 18:53:48 +03:00
parent d4470d93a3
commit 29caae487b
No known key found for this signature in database
GPG Key ID: 5DBE766BD26A54E7
22 changed files with 49 additions and 49 deletions

@ -7,8 +7,8 @@ The version comparison is done by the [go-version](https://github.com/hashicorp/
import ( import (
// [...] // [...]
"github.com/kataras/iris" "github.com/kataras/iris/v12"
"github.com/kataras/iris/versioning" "github.com/kataras/iris/v12/versioning"
) )
``` ```

@ -7,7 +7,7 @@ Create an empty file, let's assume its name is `example.go`, then open it and co
```go ```go
package main package main
import "github.com/kataras/iris" import "github.com/kataras/iris/v12"
func main() { func main() {
app := iris.Default() app := iris.Default()
@ -42,7 +42,7 @@ Let's take a small overview of how easy is to get up and running.
```go ```go
package main package main
import "github.com/kataras/iris" import "github.com/kataras/iris/v12"
func main() { func main() {
app := iris.New() app := iris.New()

@ -53,7 +53,7 @@ ReferrerGoogleAdwords
```go ```go
package main package main
import "github.com/kataras/iris" import "github.com/kataras/iris/v12"
func main() { func main() {
app := iris.New() app := iris.New()

@ -39,7 +39,7 @@ import (
"os" "os"
"net" "net"
"github.com/kataras/iris" "github.com/kataras/iris/v12"
) )
func main() { func main() {
@ -83,7 +83,7 @@ import (
// - TCP_FASTOPEN. See https://lwn.net/Articles/508865/ for details. // - TCP_FASTOPEN. See https://lwn.net/Articles/508865/ for details.
"github.com/valyala/tcplisten" "github.com/valyala/tcplisten"
"github.com/kataras/iris" "github.com/kataras/iris/v12"
) )
// go get github.com/valyala/tcplisten // go get github.com/valyala/tcplisten
@ -225,7 +225,7 @@ import (
"context" "context"
"time" "time"
"github.com/kataras/iris" "github.com/kataras/iris/v12"
) )

@ -10,10 +10,10 @@ $ export GO111MODULE=on
## Install ## Install
```sh ```sh
$ go get github.com/kataras/iris@master $ go get github.com/kataras/iris/v12@latest
``` ```
Or edit your project's `go.mod` file, add the following [pseudo-version](https://golang.org/cmd/go/#hdr-Pseudo_versions) and execute `$ go build`. Or edit your project's `go.mod` file.
```sh ```sh
module your_project_name module your_project_name
@ -21,7 +21,7 @@ module your_project_name
go 1.13 go 1.13
require ( require (
github.com/kataras/iris v0.0.0-20191005193354-55afd07befa8 github.com/kataras/iris/v12 v12.0.0
) )
``` ```
@ -32,7 +32,7 @@ require (
Here is the go-get command to get the latest and greatest Iris version. Master branch is usually stable enough. Here is the go-get command to get the latest and greatest Iris version. Master branch is usually stable enough.
```bash ```bash
$ go get -u github.com/kataras/iris $ go get -u github.com/kataras/iris/v12@latest
``` ```
## Troubleshooting ## Troubleshooting

14
MVC.md

@ -8,7 +8,7 @@ Iris has **first-class support for the MVC (Model View Controller) architectural
these stuff anywhere else in the Go world. You will have to import the [iris/mvc](https://github.com/kataras/iris/tree/master/mvc) subpackage. these stuff anywhere else in the Go world. You will have to import the [iris/mvc](https://github.com/kataras/iris/tree/master/mvc) subpackage.
```go ```go
import "github.com/kataras/iris/mvc" import "github.com/kataras/iris/v12/mvc"
``` ```
Iris web framework supports Request data, Models, Persistence Data and Binding Iris web framework supports Request data, Models, Persistence Data and Binding
@ -26,8 +26,8 @@ Serve custom controller's struct's methods as handlers with custom paths(even wi
```go ```go
import ( import (
"github.com/kataras/iris" "github.com/kataras/iris/v12"
"github.com/kataras/iris/mvc" "github.com/kataras/iris/v12/mvc"
) )
func main() { func main() {
@ -170,11 +170,11 @@ or high-level controllers: easier to maintain and smaller codebase on large appl
package main package main
import ( import (
"github.com/kataras/iris" "github.com/kataras/iris/v12"
"github.com/kataras/iris/mvc" "github.com/kataras/iris/v12/mvc"
"github.com/kataras/iris/middleware/logger" "github.com/kataras/iris/v12/middleware/logger"
"github.com/kataras/iris/middleware/recover" "github.com/kataras/iris/v12/middleware/recover"
) )
func main() { func main() {

@ -14,7 +14,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/kataras/iris" "github.com/kataras/iris/v12"
"gopkg.in/go-playground/validator.v9" "gopkg.in/go-playground/validator.v9"
) )

@ -22,7 +22,7 @@ The jwt middleware has three methods to validate tokens.
```go ```go
import ( import (
"github.com/kataras/iris" "github.com/kataras/iris/v12"
"github.com/iris-contrib/middleware/jwt" "github.com/iris-contrib/middleware/jwt"
) )

@ -57,7 +57,7 @@ Record operation log in global Interceptor.
```go ```go
package main package main
import "github.com/kataras/iris" import "github.com/kataras/iris/v12"
func main() { func main() {
app := iris.New() app := iris.New()

@ -9,7 +9,7 @@ Example code:
```go ```go
package main package main
import "github.com/kataras/iris" import "github.com/kataras/iris/v12"
func main(){ func main(){
app := iris.New() app := iris.New()

@ -9,7 +9,7 @@ A middleware is just a **Handler** form of `func(ctx iris.Context)`, the middlew
```go ```go
package main package main
import "github.com/kataras/iris" import "github.com/kataras/iris/v12"
func main() { func main() {
app := iris.New() app := iris.New()
@ -60,7 +60,7 @@ After the mainHandler
```go ```go
package main package main
import "github.com/kataras/iris" import "github.com/kataras/iris/v12"
func main() { func main() {
app := iris.New() app := iris.New()

@ -2,7 +2,7 @@ In this section you will learn how to override the existing [Context](https://go
The [Context](https://godoc.org/github.com/kataras/iris/context#Context) is an interface. However as you probably know, when using other frameworks you don't have that functionality of overriding even if it's used as an interface. With Iris you can **attach** your implementation to the **context pool** itself using the `app.ContextPool.Attach` method. The [Context](https://godoc.org/github.com/kataras/iris/context#Context) is an interface. However as you probably know, when using other frameworks you don't have that functionality of overriding even if it's used as an interface. With Iris you can **attach** your implementation to the **context pool** itself using the `app.ContextPool.Attach` method.
1. Let's get started by importing the `"github.com/kataras/iris/context"` which is required here. 1. Let's get started by importing the `"github.com/kataras/iris/v12/context"` which is required here.
2. Secondly, create your own Context implementation. 2. Secondly, create your own Context implementation.
3. Add the `Do` and `Next` methods where they just call the `context.Do` and `context.Next` package-level functions. 3. Add the `Do` and `Next` methods where they just call the `context.Do` and `context.Next` package-level functions.
4. Use the Application's `ContextPool` to set it as the Context implementation that should be used for the route's handlers. 4. Use the Application's `ContextPool` to set it as the Context implementation that should be used for the route's handlers.
@ -17,9 +17,9 @@ package main
import ( import (
"reflect" "reflect"
"github.com/kataras/iris" "github.com/kataras/iris/v12"
// 1. // 1.
"github.com/kataras/iris/context" "github.com/kataras/iris/v12/context"
) )
// 2. // 2.

@ -9,7 +9,7 @@ Route naming is easy, since we just call the returned `*Route` with a `Name` fie
```go ```go
package main package main
import "github.com/kataras/iris" import "github.com/kataras/iris/v12"
func main() { func main() {
app := iris.New() app := iris.New()

@ -39,7 +39,7 @@ import (
"net/http" "net/http"
"strings" "strings"
"github.com/kataras/iris" "github.com/kataras/iris/v12"
) )
func newApp() *iris.Application { func newApp() *iris.Application {

@ -120,7 +120,7 @@ There is one special method in Iris that you can use too. It's called `None` and
package main package main
import ( import (
"github.com/kataras/iris" "github.com/kataras/iris/v12"
) )
func main() { func main() {

@ -14,11 +14,11 @@ For example, to register the redis session database:
```go ```go
import ( import (
"github.com/kataras/iris" "github.com/kataras/iris/v12"
"github.com/kataras/iris/sessions" "github.com/kataras/iris/v12/sessions"
// 1. Import the session database. // 1. Import the session database.
"github.com/kataras/iris/sessions/sessiondb/redis" "github.com/kataras/iris/v12/sessions/sessiondb/redis"
) )
// 2. Initialize the database. // 2. Initialize the database.
@ -63,7 +63,7 @@ sess.UseDatabase(db)
```go ```go
import "os" import "os"
import "github.com/kataras/iris/sessions/sessiondb/boltdb" import "github.com/kataras/iris/v12/sessions/sessiondb/boltdb"
db, err := boltdb.New("./sessions.db", os.FileMode(0750)) db, err := boltdb.New("./sessions.db", os.FileMode(0750))
``` ```
@ -71,7 +71,7 @@ db, err := boltdb.New("./sessions.db", os.FileMode(0750))
**badger** **badger**
```go ```go
import "github.com/kataras/iris/sessions/sessiondb/badger" import "github.com/kataras/iris/v12/sessions/sessiondb/badger"
db, err := badger.New("./data") db, err := badger.New("./data")
``` ```

@ -5,7 +5,7 @@ Sometimes you need to temporarily store data between requests of the same user,
As we've seen the [[Sessions]] chapter, you initialize a session like this: As we've seen the [[Sessions]] chapter, you initialize a session like this:
```go ```go
import "github.com/kataras/iris/sessions" import "github.com/kataras/iris/v12/sessions"
sess := sessions.New(sessions.Config{Cookie: "cookieName", ...}) sess := sessions.New(sessions.Config{Cookie: "cookieName", ...})
``` ```

@ -22,7 +22,7 @@ Session variables are set with the `Session.Set` method and retrieved by the `Se
The sessions manager is created using the `New` package-level function. The sessions manager is created using the `New` package-level function.
```go ```go
import "github.com/kataras/iris/sessions" import "github.com/kataras/iris/v12/sessions"
sess := sessions.New(sessions.Config{Cookie: "cookieName", ...}) sess := sessions.New(sessions.Config{Cookie: "cookieName", ...})
``` ```
@ -136,9 +136,9 @@ In this example we will only allow authenticated users to view our secret messag
package main package main
import ( import (
"github.com/kataras/iris" "github.com/kataras/iris/v12"
"github.com/kataras/iris/sessions" "github.com/kataras/iris/v12/sessions"
) )
var ( var (
@ -210,7 +210,7 @@ optionally register it as a middleware and use the package-level `sessions.Get`
The `Sessions` struct value contains the `Handler` method which can be used to return an `iris.Handler` to be registered as middleware. The `Sessions` struct value contains the `Handler` method which can be used to return an `iris.Handler` to be registered as middleware.
```go ```go
import "github.com/kataras/iris/sessions" import "github.com/kataras/iris/v12/sessions"
sess := sessions.New(sessions.Config{...}) sess := sessions.New(sessions.Config{...})

@ -12,8 +12,8 @@ In our first example we will use the `iris/httptest` to test Basic Authenticatio
package main package main
import ( import (
"github.com/kataras/iris" "github.com/kataras/iris/v12"
"github.com/kataras/iris/middleware/basicauth" "github.com/kataras/iris/v12/middleware/basicauth"
) )
func newApp() *iris.Application { func newApp() *iris.Application {
@ -63,7 +63,7 @@ package main
import ( import (
"testing" "testing"
"github.com/kataras/iris/httptest" "github.com/kataras/iris/v12/httptest"
) )
func TestNewApp(t *testing.T) { func TestNewApp(t *testing.T) {
@ -105,7 +105,7 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/kataras/iris/httptest" "github.com/kataras/iris/v12/httptest"
) )
func TestCookiesBasic(t *testing.T) { func TestCookiesBasic(t *testing.T) {

@ -75,7 +75,7 @@ Please read the _comments_ too.
// file: main.go // file: main.go
package main package main
import "github.com/kataras/iris" import "github.com/kataras/iris/v12"
func main() { func main() {
app := iris.New() app := iris.New()

@ -44,7 +44,7 @@ func Handler(s *neffos.Server, IDGenerator ...IDGenerator) Handler
```go ```go
import ( import (
"github.com/kataras/neffos" "github.com/kataras/neffos"
"github.com/kataras/iris/websocket" "github.com/kataras/iris/v12/websocket"
) )
// [...] // [...]
@ -115,7 +115,7 @@ Iris is smart enough to catch the `Namespace string` struct field to use it to r
```go ```go
import ( import (
// [...] // [...]
"github.com/kataras/iris/mvc" "github.com/kataras/iris/v12/mvc"
) )
// [app := iris.New...] // [app := iris.New...]

@ -11,7 +11,7 @@ To use this feature you should import the hero subpackage:
```go ```go
import ( import (
// [...] // [...]
"github.com/kataras/iris/hero" "github.com/kataras/iris/v12/hero"
) )
``` ```