mirror of
https://github.com/kataras/iris.git
synced 2025-12-21 20:07:04 +00:00
Fan of the MVC Architectural Pattern?
Former-commit-id: c6e425e8a4b150ea78456b2db88367093c164a38
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/mvc"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -52,7 +51,7 @@ var myDB = &DB{
|
||||
// ProfileController our example user controller which controls
|
||||
// the paths of "/profile" "/profile/{id:int}" and "/profile/me".
|
||||
type ProfileController struct {
|
||||
mvc.Controller // IMPORTANT
|
||||
iris.Controller // IMPORTANT
|
||||
|
||||
User UserModel `iris:"model"`
|
||||
// we will bind it but you can also tag it with`iris:"persistence"`
|
||||
|
||||
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/mvc"
|
||||
|
||||
"github.com/kataras/iris/middleware/logger"
|
||||
"github.com/kataras/iris/middleware/recover"
|
||||
@@ -48,9 +47,8 @@ func main() {
|
||||
|
||||
// IndexController serves the "/".
|
||||
type IndexController struct {
|
||||
// if you build with go1.9 you can omit the import of mvc package
|
||||
// and just use `iris.Controller` instead.
|
||||
mvc.Controller
|
||||
// if you build with go1.8 you have to use the mvc package, `mvc.Controller` instead.
|
||||
iris.Controller
|
||||
}
|
||||
|
||||
// Get serves
|
||||
@@ -62,7 +60,7 @@ func (c *IndexController) Get() {
|
||||
|
||||
// PingController serves the "/ping".
|
||||
type PingController struct {
|
||||
mvc.Controller
|
||||
iris.Controller
|
||||
}
|
||||
|
||||
// Get serves
|
||||
@@ -74,7 +72,7 @@ func (c *PingController) Get() {
|
||||
|
||||
// HelloController serves the "/hello".
|
||||
type HelloController struct {
|
||||
mvc.Controller
|
||||
iris.Controller
|
||||
}
|
||||
|
||||
type myJSONData struct {
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/mvc"
|
||||
)
|
||||
|
||||
// paths
|
||||
@@ -22,7 +21,7 @@ const (
|
||||
|
||||
// AuthController is the user authentication controller, a custom shared controller.
|
||||
type AuthController struct {
|
||||
mvc.SessionController
|
||||
iris.SessionController
|
||||
|
||||
Source *DataSource
|
||||
User Model `iris:"model"`
|
||||
|
||||
@@ -4,15 +4,12 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/mvc"
|
||||
|
||||
"github.com/kataras/iris/sessions"
|
||||
)
|
||||
|
||||
type VisitController struct {
|
||||
// if you build with go1.9 you can omit the import of mvc package
|
||||
// and just use `iris.Controller` instead.
|
||||
mvc.SessionController
|
||||
iris.SessionController
|
||||
|
||||
StartTime time.Time
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user