Skip to content

Commit

Permalink
docs: adding example for fasthttp (#87)
Browse files Browse the repository at this point in the history
* docs(go-sdk): adding example for fasthttp

* docs(go-sdk): adding example for fasthttp
  • Loading branch information
Pradhyuman-sharma authored May 6, 2022
1 parent f06bf26 commit 66f6b62
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,42 @@ func main(){
http.ListenAndServe(":"+port, r)
}
```
### 6. FastHttp
```go
mw := kfasthttp.FastHttpMiddleware(k)
```
#### Example
```go
import(
"github.com/keploy/go-sdk/integrations/kfasthttp"
"github.com/keploy/go-sdk/keploy"
"github.com/valyala/fasthttp"
)

func main() {
k := keploy.New(keploy.Config{
App: keploy.AppConfig{
Name: "fasthttp-URL",
Port: "8080",
},
Server: keploy.ServerConfig{
URL: "http://localhost:8081/api",
},
})

mw := kfasthttp.FastHttpMiddleware(k)
m := func(ctx *fasthttp.RequestCtx) {
switch string(ctx.Path()) {
case "/index":
index(ctx)
default:
ctx.Error("not found", fasthttp.StatusNotFound)
}
}
log.Fatal(fasthttp.ListenAndServe(":8080", mw(m)))
}
```


## Supported Databases
### 1. MongoDB
Expand Down

0 comments on commit 66f6b62

Please sign in to comment.