Skip to content

Commit

Permalink
README: minor
Browse files Browse the repository at this point in the history
  • Loading branch information
kataras committed Jul 26, 2020
1 parent 22a89c1 commit 613d3fc
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,39 @@ func create(ctx iris.Context) {
}
```

**MVC** equivalent:

```go
import "github.com/kataras/iris/v12/mvc"
```

```go
m := mvc.New(booksAPI)
m.Handle(new(BookController))
```

```go
type BookController struct {
/* dependencies */
}

// GET: http://localhost:8080/books
func (c *BookController) Get() []Book {
return []Book{
{"Mastering Concurrency in Go"},
{"Go Design Patterns"},
{"Black Hat Go"},
}
}

// POST: http://localhost:8080/books
func (c *BookController) Post(b Book) int {
println("Received Book: " + b.Title)

return iris.StatusCreated
}
```

**Run** your Iris web server:

```sh
Expand Down

0 comments on commit 613d3fc

Please sign in to comment.