1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-10 05:25:58 +00:00

new {weekday} path parameter type

This commit is contained in:
kataras
2022-06-23 23:01:52 +03:00
parent 999e83723b
commit 8bfea48cd6
6 changed files with 146 additions and 12 deletions

View File

@@ -28,6 +28,18 @@ The codebase for Dependency Injection, Internationalization and localization and
## Fixes and Improvements
- New `{x:weekday}` path parameter type, example code:
```go
// 0 to 7 (leading zeros don't matter) or "Sunday" to "Monday" or "sunday" to "monday".
// http://localhost:8080/schedule/monday or http://localhost:8080/schedule/Monday or
// http://localhost:8080/schedule/1 or http://localhost:8080/schedule/0001.
app.Get("/schedule/{day:weekday}", func(ctx iris.Context) {
day, _ := ctx.Params().GetWeekday("day")
ctx.Writef("Weekday requested was: %v\n", day)
})
```
- Make the `Context.JSON` method customizable by modifying the `context.WriteJSON` package-level function.
- Add new `iris.NewGuide` which helps you build a simple and nice JSON API with services as dependencies and better design pattern.
- Make `Context.Domain()` customizable by letting developers to modify the `Context.GetDomain` package-level function.