func (htmlServer *HTMLServer) Stop() error {
	const timeout = 5 * time.Second
	ctx, cancel := context.WithTimeout(context.Background(), timeout)
	defer cancel()
	fmt.Printf("\nFetch Server : Service stopping\n")
	if err := htmlServer.server.Shutdown(ctx); err != nil {
		if err := htmlServer.server.Close(); err != nil {
			fmt.Printf("\nFetch Server : Service stopping : Error=%v\n", err)
			return err
		}
	}
	htmlServer.wg.Wait()
	fmt.Printf("\nFetch Server : Stopped\n")
	return nil
}
Stop turns off the HTML Server
package fetch
import (
	"context"
	"fmt"
	"net/http"
	"os"
	"sync"
	"time"
	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
)
type Config struct {
	Host    string
	Version string
}
type HTMLServer struct {
	server *http.Server
	wg     sync.WaitGroup
}
func Start(cfg Config) *HTMLServer {
	ctx := context.Background()
	_, cancel := context.WithCancel(ctx)
	defer cancel()
	encoderCfg := zapcore.EncoderConfig{
		TimeKey:        "ts",
		MessageKey:     "msg",
		LevelKey:       "level",
		NameKey:        "fetcher",
		EncodeLevel:    zapcore.CapitalColorLevelEncoder,
		EncodeTime:     zapcore.ISO8601TimeEncoder,
		EncodeDuration: zapcore.StringDurationEncoder,
		EncodeName:     zapcore.FullNameEncoder,
	}
	core := zapcore.NewCore(zapcore.NewConsoleEncoder(encoderCfg), os.Stdout, zapcore.DebugLevel)
	logger := zap.New(core)
	defer logger.Sync()  
	var svc Service
	svc = FetchService{}
	endpoints := endpoints{
		fetchEndpoint: makeFetchEndpoint(svc),
	}
	r := newHttpHandler(ctx, endpoints)
	htmlServer := HTMLServer{
		server: &http.Server{
			Addr:           cfg.Host,
			Handler:        r,
			MaxHeaderBytes: 1 << 20,
		},
	}
	htmlServer.wg.Add(1)
	go func() {
		fmt.Printf("\n%s\nStarting ...%s",
			cfg.Version,
			htmlServer.server.Addr,
		)
		htmlServer.server.ListenAndServe()
		htmlServer.wg.Done()
	}()
	return &htmlServer
}