mirror of
https://github.com/kataras/iris.git
synced 2025-03-13 22:36:24 +01:00
update wiki to iris v12.0.0
parent
d4470d93a3
commit
29caae487b
|
@ -7,8 +7,8 @@ The version comparison is done by the [go-version](https://github.com/hashicorp/
|
|||
import (
|
||||
// [...]
|
||||
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/versioning"
|
||||
"github.com/kataras/iris/v12"
|
||||
"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
|
||||
package main
|
||||
|
||||
import "github.com/kataras/iris"
|
||||
import "github.com/kataras/iris/v12"
|
||||
|
||||
func main() {
|
||||
app := iris.Default()
|
||||
|
@ -42,7 +42,7 @@ Let's take a small overview of how easy is to get up and running.
|
|||
```go
|
||||
package main
|
||||
|
||||
import "github.com/kataras/iris"
|
||||
import "github.com/kataras/iris/v12"
|
||||
|
||||
func main() {
|
||||
app := iris.New()
|
||||
|
|
|
@ -53,7 +53,7 @@ ReferrerGoogleAdwords
|
|||
```go
|
||||
package main
|
||||
|
||||
import "github.com/kataras/iris"
|
||||
import "github.com/kataras/iris/v12"
|
||||
|
||||
func main() {
|
||||
app := iris.New()
|
||||
|
|
6
Host.md
6
Host.md
|
@ -39,7 +39,7 @@ import (
|
|||
"os"
|
||||
"net"
|
||||
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/v12"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -83,7 +83,7 @@ import (
|
|||
// - TCP_FASTOPEN. See https://lwn.net/Articles/508865/ for details.
|
||||
"github.com/valyala/tcplisten"
|
||||
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/v12"
|
||||
)
|
||||
|
||||
// go get github.com/valyala/tcplisten
|
||||
|
@ -225,7 +225,7 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/v12"
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ $ export GO111MODULE=on
|
|||
## Install
|
||||
|
||||
```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
|
||||
module your_project_name
|
||||
|
@ -21,7 +21,7 @@ module your_project_name
|
|||
go 1.13
|
||||
|
||||
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.
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/kataras/iris
|
||||
$ go get -u github.com/kataras/iris/v12@latest
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
|
14
MVC.md
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.
|
||||
|
||||
```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
|
||||
|
@ -26,8 +26,8 @@ Serve custom controller's struct's methods as handlers with custom paths(even wi
|
|||
|
||||
```go
|
||||
import (
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/mvc"
|
||||
"github.com/kataras/iris/v12"
|
||||
"github.com/kataras/iris/v12/mvc"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -170,11 +170,11 @@ or high-level controllers: easier to maintain and smaller codebase on large appl
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/mvc"
|
||||
"github.com/kataras/iris/v12"
|
||||
"github.com/kataras/iris/v12/mvc"
|
||||
|
||||
"github.com/kataras/iris/middleware/logger"
|
||||
"github.com/kataras/iris/middleware/recover"
|
||||
"github.com/kataras/iris/v12/middleware/logger"
|
||||
"github.com/kataras/iris/v12/middleware/recover"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -14,7 +14,7 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/v12"
|
||||
|
||||
"gopkg.in/go-playground/validator.v9"
|
||||
)
|
||||
|
|
|
@ -22,7 +22,7 @@ The jwt middleware has three methods to validate tokens.
|
|||
|
||||
```go
|
||||
import (
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/v12"
|
||||
"github.com/iris-contrib/middleware/jwt"
|
||||
)
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ Record operation log in global Interceptor.
|
|||
```go
|
||||
package main
|
||||
|
||||
import "github.com/kataras/iris"
|
||||
import "github.com/kataras/iris/v12"
|
||||
|
||||
func main() {
|
||||
app := iris.New()
|
||||
|
|
|
@ -9,7 +9,7 @@ Example code:
|
|||
```go
|
||||
package main
|
||||
|
||||
import "github.com/kataras/iris"
|
||||
import "github.com/kataras/iris/v12"
|
||||
|
||||
func main(){
|
||||
app := iris.New()
|
||||
|
|
|
@ -9,7 +9,7 @@ A middleware is just a **Handler** form of `func(ctx iris.Context)`, the middlew
|
|||
```go
|
||||
package main
|
||||
|
||||
import "github.com/kataras/iris"
|
||||
import "github.com/kataras/iris/v12"
|
||||
|
||||
func main() {
|
||||
app := iris.New()
|
||||
|
@ -60,7 +60,7 @@ After the mainHandler
|
|||
```go
|
||||
package main
|
||||
|
||||
import "github.com/kataras/iris"
|
||||
import "github.com/kataras/iris/v12"
|
||||
|
||||
func main() {
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
@ -17,9 +17,9 @@ package main
|
|||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/v12"
|
||||
// 1.
|
||||
"github.com/kataras/iris/context"
|
||||
"github.com/kataras/iris/v12/context"
|
||||
)
|
||||
|
||||
// 2.
|
||||
|
|
|
@ -9,7 +9,7 @@ Route naming is easy, since we just call the returned `*Route` with a `Name` fie
|
|||
```go
|
||||
package main
|
||||
|
||||
import "github.com/kataras/iris"
|
||||
import "github.com/kataras/iris/v12"
|
||||
|
||||
func main() {
|
||||
app := iris.New()
|
||||
|
|
|
@ -39,7 +39,7 @@ import (
|
|||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/v12"
|
||||
)
|
||||
|
||||
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
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/v12"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -14,11 +14,11 @@ For example, to register the redis session database:
|
|||
|
||||
```go
|
||||
import (
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/sessions"
|
||||
"github.com/kataras/iris/v12"
|
||||
"github.com/kataras/iris/v12/sessions"
|
||||
|
||||
// 1. Import the session database.
|
||||
"github.com/kataras/iris/sessions/sessiondb/redis"
|
||||
"github.com/kataras/iris/v12/sessions/sessiondb/redis"
|
||||
)
|
||||
|
||||
// 2. Initialize the database.
|
||||
|
@ -63,7 +63,7 @@ sess.UseDatabase(db)
|
|||
|
||||
```go
|
||||
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))
|
||||
```
|
||||
|
@ -71,7 +71,7 @@ db, err := boltdb.New("./sessions.db", os.FileMode(0750))
|
|||
**badger**
|
||||
|
||||
```go
|
||||
import "github.com/kataras/iris/sessions/sessiondb/badger"
|
||||
import "github.com/kataras/iris/v12/sessions/sessiondb/badger"
|
||||
|
||||
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:
|
||||
|
||||
```go
|
||||
import "github.com/kataras/iris/sessions"
|
||||
import "github.com/kataras/iris/v12/sessions"
|
||||
|
||||
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.
|
||||
|
||||
```go
|
||||
import "github.com/kataras/iris/sessions"
|
||||
import "github.com/kataras/iris/v12/sessions"
|
||||
|
||||
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
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/v12"
|
||||
|
||||
"github.com/kataras/iris/sessions"
|
||||
"github.com/kataras/iris/v12/sessions"
|
||||
)
|
||||
|
||||
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.
|
||||
|
||||
```go
|
||||
import "github.com/kataras/iris/sessions"
|
||||
import "github.com/kataras/iris/v12/sessions"
|
||||
|
||||
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
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/middleware/basicauth"
|
||||
"github.com/kataras/iris/v12"
|
||||
"github.com/kataras/iris/v12/middleware/basicauth"
|
||||
)
|
||||
|
||||
func newApp() *iris.Application {
|
||||
|
@ -63,7 +63,7 @@ package main
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/kataras/iris/httptest"
|
||||
"github.com/kataras/iris/v12/httptest"
|
||||
)
|
||||
|
||||
func TestNewApp(t *testing.T) {
|
||||
|
@ -105,7 +105,7 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/kataras/iris/httptest"
|
||||
"github.com/kataras/iris/v12/httptest"
|
||||
)
|
||||
|
||||
func TestCookiesBasic(t *testing.T) {
|
||||
|
|
2
View.md
2
View.md
|
@ -75,7 +75,7 @@ Please read the _comments_ too.
|
|||
// file: main.go
|
||||
package main
|
||||
|
||||
import "github.com/kataras/iris"
|
||||
import "github.com/kataras/iris/v12"
|
||||
|
||||
func main() {
|
||||
app := iris.New()
|
||||
|
|
|
@ -44,7 +44,7 @@ func Handler(s *neffos.Server, IDGenerator ...IDGenerator) Handler
|
|||
```go
|
||||
import (
|
||||
"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
|
||||
import (
|
||||
// [...]
|
||||
"github.com/kataras/iris/mvc"
|
||||
"github.com/kataras/iris/v12/mvc"
|
||||
)
|
||||
// [app := iris.New...]
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ To use this feature you should import the hero subpackage:
|
|||
```go
|
||||
import (
|
||||
// [...]
|
||||
"github.com/kataras/iris/hero"
|
||||
"github.com/kataras/iris/v12/hero"
|
||||
)
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user