func routeHandler() *http.ServeMux {
	router := http.NewServeMux()
	router.HandleFunc("/", indexHandler)
	router.HandleFunc("/excel", excelHandler)
	router.HandleFunc("/qr-code-generator", qrCodeHandler)
	router.HandleFunc("/svg", svgHandler)
	router.HandleFunc("/sphere", sphereHandler)
	router.HandleFunc("/health", healthHandler)
	router.HandleFunc("/log", logHandler)
	return router
}
This is our route handler:
package main
import (
	"bytes"
	"context"
	"flag"
	"fmt"
	"html/template"
	"io/ioutil"
	"log"
	"math"
	"net/http"
	"os"
	"os/signal"
	"sync/atomic"
	"syscall"
	"time"
)
const (
	REQUEST_ID_KEY         = 8888
	READ_TIMEOUT           = 10
	WRITE_TIMEOUT          = 10
	IDLE_TIMEOUT           = 30
	LOG_FILE_NAME          = "server_log.log"
	DEFAULT_SERVER_ADDRESS = "8888"
)
var (
	listenAddr string
	healthy    int32
)
func main() {
	flag.StringVar(&listenAddr, "address", ":"+DEFAULT_SERVER_ADDRESS, "http service address")
	flag.Parse()
	logFile, err := os.OpenFile(LOG_FILE_NAME, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
	if err != nil {
		log.Fatalf("Error opening file: %v", err)
	}
	defer logFile.Close()
	logger := log.New(logFile, "http: ", log.LstdFlags)
	nextRequestID := func() string {
		return fmt.Sprintf("%d", time.Now().UnixNano())
	}
	server := &http.Server{
		Addr:         listenAddr,
		Handler:      tracingHandler(nextRequestID)(loggingHandler(logger)(routeHandler())),
		ErrorLog:     logger,
		ReadTimeout:  READ_TIMEOUT * time.Second,
		WriteTimeout: WRITE_TIMEOUT * time.Second,
		IdleTimeout:  IDLE_TIMEOUT * time.Second,
	}
	doneChannel := make(chan bool)
	quitChannel := make(chan os.Signal, 1)
	signal.Notify(quitChannel, os.Interrupt, syscall.SIGTERM)
	go func() {
		<-quitChannel
		logger.Println("Server is shutting down...")
		atomic.StoreInt32(&healthy, 0)
		ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
		defer cancel()
		server.SetKeepAlivesEnabled(false)
		if err := server.Shutdown(ctx); err != nil {
			logger.Fatalf("Could not gracefully shutdown the server: %v\n", err)
		}
		close(doneChannel)
	}()
	logger.Println("Server is ready to handle requests at ", listenAddr)
	atomic.StoreInt32(&healthy, 1)
	if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
		logger.Fatalf("Could not listen on %s: %v\n", listenAddr, err)
	}
	<-doneChannel
	logger.Println("Server stopped")
}