mirror of
https://github.com/kataras/iris.git
synced 2025-12-22 04:17:03 +00:00
8.4.0 | New MVC Features | Refactor examples and godoc for go 1.9 use. Read HISTORY.md.
Former-commit-id: 90c05e743052bc3722e7fefaa0cbb0ed5153a1fb
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"time" // showcase the delay
|
||||
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/context"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -14,7 +13,7 @@ func main() {
|
||||
|
||||
timeWaitForCloseStream := 4 * time.Second
|
||||
|
||||
app.Get("/", func(ctx context.Context) {
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
i := 0
|
||||
// goroutine in order to no block and just wait,
|
||||
// goroutine is OPTIONAL and not a very good option but it depends on the needs
|
||||
@@ -35,7 +34,7 @@ func main() {
|
||||
time.Sleep(timeWaitForCloseStream)
|
||||
})
|
||||
|
||||
app.Get("/alternative", func(ctx context.Context) {
|
||||
app.Get("/alternative", func(ctx iris.Context) {
|
||||
// Send the response in chunks and wait for a second between each chunk.
|
||||
ctx.StreamWriter(func(w io.Writer) bool {
|
||||
for i := 1; i <= 4; i++ {
|
||||
|
||||
Reference in New Issue
Block a user