func NewServer(opts *ServerOpts) *Server {
	if opts == nil {
		return &Server{
			ErrorLogger: func(v ...interface{}) {},
		}
	}
	if opts.ErrorHandler == nil {
		opts.ErrorHandler = func(v ...interface{}) {}
	}
	server := &Server{
		ErrorLogger: opts.ErrorHandler,
	}
	if opts.OnStart != nil {
		server.OnStart = opts.OnStart
	}
	if len(opts.Middleware) != 0 {
		before := make([]routing.Handler, 0)
		after := make([]routing.Handler, 0)
		for _, m := range opts.Middleware {
			if m.After {
				after = append(after, m.Handler)
			} else {
				before = append(before, m.Handler)
			}
		}
		server.after = after
		server.before = before
	}
	server.ReadTimeout = opts.ReadTimeout
	server.ReadHeaderTimeout = opts.ReadHeaderTimeout
	server.WriteTimeout = opts.WriteTimeout
	server.IdleTimeout = opts.IdleTimeout
	return server
}
NewServer initializes a new Server instance with a middleware handler.
middleware represents middleware handler that will be executed before  or after the actual
handler of each server endpoint.
package xserver
import (
	"context"
	"fmt"
	"net/http"
	"strconv"
	"time"
	"encoding/json"
	"runtime/debug"
	"github.com/ExperienceOne/apikit/internal/framework/xhttperror"
	"github.com/go-ozzo/ozzo-routing"
	"github.com/go-ozzo/ozzo-routing/fault"
)
type (
	Timeouts struct {
		ReadTimeout       time.Duration
		ReadHeaderTimeout time.Duration
		WriteTimeout      time.Duration
		IdleTimeout       time.Duration
	}
	ServerOpts struct {
		Timeouts
		ErrorHandler ErrorHandler
		Middleware   []Middleware
		OnStart      func(router *routing.Router)
	}
	Middleware struct {
		Handler routing.Handler
		After   bool
	}
	RouteDescription struct {
		Path       string
		Handler    routing.Handler
		Middleware []Middleware
		Method     string
	}
	Server struct {
		Timeouts
		ErrorLogger func(v ...interface{})
		OnStart     func(router *routing.Router)
		server      *http.Server
		Router      *routing.Router
		after       []routing.Handler
		before      []routing.Handler
		SwaggerSpec string
	}
)
type ErrorHandler func(v ...interface{})