You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
456 B
26 lines
456 B
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/valyala/fasthttp"
|
|
)
|
|
|
|
type HelloWorldHandler struct {
|
|
}
|
|
|
|
func fastHTTPHandler(ctx *fasthttp.RequestCtx) {
|
|
fmt.Fprintln(ctx, "Hello, World!")
|
|
}
|
|
|
|
func main() {
|
|
s := &fasthttp.Server{
|
|
Handler: fastHTTPHandler,
|
|
ReadTimeout: 10 * time.Second,
|
|
WriteTimeout: 10 * time.Second,
|
|
IdleTimeout: 10 * time.Second,
|
|
}
|
|
fmt.Println("Listening for requests on port 8002...")
|
|
s.ListenAndServe(":8002")
|
|
}
|
|
|