Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HelloController ¶
HelloController is our sample controller it handles GET: /hello and GET: /hello/{name}
func (*HelloController) Get ¶
func (c *HelloController) Get() mvc.Result
Get will return a predefined view with bind data.
`mvc.Result` is just an interface with a `Dispatch` function. `mvc.Response` and `mvc.View` are the built'n result type dispatchers you can even create custom response dispatchers by implementing the `github.com/kataras/iris/mvc#Result` interface.
func (*HelloController) GetBy ¶
func (c *HelloController) GetBy(name string) mvc.Result
GetBy returns a "Hello {name}" response. Demos: curl -i http://localhost:8080/hello/iris curl -i http://localhost:8080/hello/anything
type MoviesController ¶
type MoviesController struct { // mvc.C is just a lightweight lightweight alternative // to the "mvc.Controller" controller type, // use it when you don't need mvc.Controller's fields // (you don't need those fields when you return values from the method functions). mvc.C }
MoviesController is our /movies controller.
func (*MoviesController) DeleteBy ¶
func (c *MoviesController) DeleteBy(id int) iris.Map
DeleteBy deletes a movie. Demo: curl -i -X DELETE -u admin:password http://localhost:8080/movies/1
func (*MoviesController) Get ¶
func (c *MoviesController) Get() []models.Movie
Get returns list of the movies. Demo: curl -i http://localhost:8080/movies
func (*MoviesController) GetBy ¶
func (c *MoviesController) GetBy(id int) models.Movie
GetBy returns a movie. Demo: curl -i http://localhost:8080/movies/1
func (*MoviesController) PutBy ¶
func (c *MoviesController) PutBy(id int) (models.Movie, int)
PutBy updates a movie. Demo: curl -i -X PUT -F "genre=Thriller" -F "poster=@/Users/kataras/Downloads/out.gif" http://localhost:8080/movies/1