Skip to content

Commit 798f4cf

Browse files
committed
Update README.md
1 parent ba54488 commit 798f4cf

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

go/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,32 @@ curl -X POST http://localhost:8080/tellJoke \
462462
-d '{"data": "programming"}'
463463
```
464464

465+
### Works with Any HTTP Framework
466+
467+
`genkit.Handler` returns a standard `http.HandlerFunc`, so it works with any Go HTTP framework:
468+
469+
```go
470+
// net/http (standard library)
471+
mux := http.NewServeMux()
472+
mux.HandleFunc("POST /joke", genkit.Handler(jokeFlow))
473+
log.Fatal(http.ListenAndServe(":8080", mux))
474+
475+
// Gin
476+
r := gin.Default()
477+
r.POST("/joke", gin.WrapF(genkit.Handler(jokeFlow)))
478+
r.Run(":8080")
479+
480+
// Echo
481+
e := echo.New()
482+
e.POST("/joke", echo.WrapHandler(genkit.Handler(jokeFlow)))
483+
e.Start(":8080")
484+
485+
// Chi
486+
r := chi.NewRouter()
487+
r.Post("/joke", genkit.Handler(jokeFlow))
488+
http.ListenAndServe(":8080", r)
489+
```
490+
465491
---
466492

467493
## Model Providers

0 commit comments

Comments
 (0)