mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 18:51:03 +01:00
0d26f24eb7
Former-commit-id: d20afb2e899aee658a8e0ed1693357798df93462
27 lines
439 B
Go
27 lines
439 B
Go
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)
|
|
}
|