YAML
type ExampleYAML struct {
Name string `yaml:"name"`
ServerAddr string `yaml:"ServerAddr"`
}
func handler(ctx iris.Context) {
response := ExampleYAML{Name: "Iris", ServerAddr: "localhost:8080"}
ctx.YAML(response)
}name: Iris
ServerAddr: localhost:8080func handler(ctx iris.Context) {
response := iris.Map{"name": "Iris", "serverAddr": "localhost:8080"}
ctx.YAML(response)
}Last updated
Was this helpful?