FastHTTPHandler creates fasthttp.RequestHandler. Routes: GET /ping return "pong"
()
| 10 | // |
| 11 | // GET /ping return "pong" |
| 12 | func FastHTTPHandler() fasthttp.RequestHandler { |
| 13 | return func(ctx *fasthttp.RequestCtx) { |
| 14 | switch string(ctx.Path()) { |
| 15 | case "/ping": |
| 16 | ctx.SetStatusCode(fasthttp.StatusOK) |
| 17 | ctx.SetContentType("text/plain") |
| 18 | ctx.SetBody([]byte("pong")) |
| 19 | |
| 20 | default: |
| 21 | panic("unsupported path") |
| 22 | } |
| 23 | } |
| 24 | } |
searching dependent graphs…