httpserver

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package httpserver provides a simple HTTP server that serves the API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GRPCHTTPHandlerRegister

type GRPCHTTPHandlerRegister func(context.Context, *runtime.ServeMux, *grpc.ClientConn) error

GRPCHTTPHandlerRegister is a function that registers the grpc-gateway handlers

type HTTPServer

type HTTPServer struct {
	// contains filtered or unexported fields
}

HTTPServer is the http server implementation

func NewHTTPServer

func NewHTTPServer(ctx context.Context, opts ...Opt) *HTTPServer

NewHTTPServer creates a new HTTPServer

func (*HTTPServer) Serve

func (s *HTTPServer) Serve() error

Serve starts the http server

type Opt

type Opt func(*HTTPServer)

Opt is a functional option for HttpServer

func WithClient

func WithClient(conn *grpc.ClientConn) Opt

WithClient sets the grpc client for the HTTPServer

func WithLogger

func WithLogger(logger *zap.Logger) Opt

WithLogger sets the logger for the HTTPServer

func WithRegisters

func WithRegisters(registers ...GRPCHTTPHandlerRegister) Opt

WithRegisters sets the http handlers for the HTTPServer

func WithServer

func WithServer(server *http.Server) Opt

WithServer sets the http server for the HTTPServer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL