mirror of
https://github.com/kataras/iris.git
synced 2025-12-19 10:57:05 +00:00
Update to version 8.5.0 | NEW: MVC Output Result | Read HISTORY.md
Former-commit-id: 6a3579f2500fc715d7dc606478960946dcade61d
This commit is contained in:
33
_examples/mvc/using-method-result/main.go
Normal file
33
_examples/mvc/using-method-result/main.go
Normal file
@@ -0,0 +1,33 @@
|
||||
// file: main.go
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris/_examples/mvc/using-method-result/controllers"
|
||||
"github.com/kataras/iris/_examples/mvc/using-method-result/middleware"
|
||||
|
||||
"github.com/kataras/iris"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := iris.New()
|
||||
// Load the template files.
|
||||
app.RegisterView(iris.HTML("./views", ".html"))
|
||||
|
||||
// Register our controllers.
|
||||
app.Controller("/hello", new(controllers.HelloController))
|
||||
// Add the basic authentication(admin:password) middleware
|
||||
// for the /movies based requests.
|
||||
app.Controller("/movies", new(controllers.MoviesController), middleware.BasicAuth)
|
||||
|
||||
// Start the web server at localhost:8080
|
||||
// http://localhost:8080/hello
|
||||
// http://localhost:8080/hello/iris
|
||||
// http://localhost:8080/movies/1
|
||||
app.Run(
|
||||
iris.Addr("localhost:8080"),
|
||||
iris.WithoutVersionChecker,
|
||||
iris.WithoutServerError(iris.ErrServerClosed),
|
||||
iris.WithOptimizations, // enables faster json serialization and more
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user