1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 10:27:06 +00:00

update some examples

Former-commit-id: 2ed7c323dd379eb68d5ccb2044cd9cc772ce0b08
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-05-05 22:03:01 +03:00
parent c10dd32ad7
commit cc19f80049
14 changed files with 20 additions and 19 deletions

View File

@@ -0,0 +1,26 @@
package main
import (
"flag"
"github.com/kataras/iris/v12"
)
var addr = flag.String("addr", ":8080", "host:port to listen on")
// $ docker-compose up
func main() {
flag.Parse()
app := iris.New()
app.Get("/", func(ctx iris.Context) {
ctx.HTML("<strong>Hello World!</strong>")
})
app.Get("/api/values/{id:uint}", func(ctx iris.Context) {
ctx.Writef("id: %d", ctx.Params().GetUintDefault("id", 0))
})
app.Listen(*addr)
}