INNER CODE UNIT · Go

main

apache/apisix · t/sse_server_example/main.go:133

func main() {
	http.HandleFunc("/v1/chat/completions", logRequest(completionsHandler))
	http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
		w.WriteHeader(http.StatusOK)
		w.Write([]byte("OK"))
	})
	go func() {
		for {
			log.Printf("Processed %d requests", counter)
			time.Sleep(1 * time.Minute)
		}
	}()
	port := os.Args[1]
	log.Println("Starting server on :", port)
	log.Fatal(http.ListenAndServe(":"+port, nil))
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…