INNER CODE UNIT · Go

mainHandler

networknt/microservices-framework-benchmark · go-fasthttp/server.go:36

func mainHandler(ctx *fasthttp.RequestCtx) {
    path := ctx.Path()
    switch string(path) {
    case "/":
        plaintextHandler(ctx)
    default:
        ctx.Error("unexpected path", fasthttp.StatusBadRequest)
    }
}

func plaintextHandler(ctx *fasthttp.RequestCtx) {
    ctx.SetContentType("text/plain")
    ctx.WriteString("Hello World!")
}

func getListener() net.Listener {
    if !*prefork {
        runtime.GOMAXPROCS(runtime.NumCPU())

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…