1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-21 11:57:02 +00:00

add content type and response text to the Controller 💯

Former-commit-id: 99cde0a445027b10839155501a7918732a783af3
This commit is contained in:
hiveminded
2017-09-02 14:32:14 +03:00
parent fe94840929
commit d7ec0d4416
6 changed files with 107 additions and 73 deletions

View File

@@ -16,9 +16,9 @@ func main() {
app.Use(logger.New())
// Method: GET
// Resource: http://localhost:8080/
// Resource: http://localhost:8080
app.Handle("GET", "/", func(ctx iris.Context) {
ctx.HTML("<b>Welcome!</b>")
ctx.HTML("<h1>Welcome</h1>")
})
// same as app.Handle("GET", "/ping", [...])
@@ -31,7 +31,7 @@ func main() {
// Method: GET
// Resource: http://localhost:8080/hello
app.Get("/hello", func(ctx iris.Context) {
ctx.JSON(iris.Map{"message": "Hello iris web framework."})
ctx.JSON(iris.Map{"message": "Hello Iris!"})
})
// http://localhost:8080