mirror of
https://github.com/kataras/iris.git
synced 2025-12-19 10:57:05 +00:00
add a simple docker example
Former-commit-id: cacfa3ad903ce542ce455cb2298c40639c645d3c
This commit is contained in:
26
_examples/docker/main.go
Normal file
26
_examples/docker/main.go
Normal 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.Run(iris.Addr(*addr))
|
||||
}
|
||||
Reference in New Issue
Block a user