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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user