server

package
v0.0.0-...-a483330 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadConfig

func ReadConfig(filePath string, target *Config) error

ReadConfig Read config from file path specified in first argument and write values into target config

Types

type Config

type Config struct {
	BindAddr string                    `json:"port"`
	LogLevel string                    `json:"logLevel"`
	MySQL    map[string]mysql.Config   `json:"mysql"`
	Mongodb  map[string]mongodb.Config `json:"mongodb"`
}

Config - config for 'connector' server

func NewConfig

func NewConfig() *Config

NewConfig - initialize new config with default values for connector server. You can override default values for your purposes. Default values:

BindAddr: ":3030"
LogLevel: "debug"

type Server

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

Server - connector server struct

func New

func New(config *Config) *Server

New - initialize new connector server

func (*Server) CheckMethod

func (s *Server) CheckMethod(h http.Handler, method string) http.Handler

func (*Server) NewResponseError

func (s *Server) NewResponseError(w http.ResponseWriter, message, reason string, code int)

NewResponseError creates and sends to client custom response about error

func (*Server) Run

func (s *Server) Run() error

Run connector server

Jump to

Keyboard shortcuts

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