rest

package
v0.0.0-...-e78cd55 Latest Latest
Warning

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

Go to latest
Published: May 2, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IncreaseDeleteRequests

func IncreaseDeleteRequests()

func IncreaseGetRequests

func IncreaseGetRequests()

func IncreasePostRequests

func IncreasePostRequests()

func IncreasePutRequests

func IncreasePutRequests()

func RegisterCustomMetrics

func RegisterCustomMetrics()

Types

type Config

type Config struct {
	RestHost string
	RestPort int
}

type Result

type Result struct {
	Message string `json:"Message"`
}

type Server

type Server struct {
	Config     *Config
	Router     *mux.Router
	HTTPServer *http.Server
	Running    bool
	// contains filtered or unexported fields
}

func NewRestServer

func NewRestServer() *Server

NewRestServer - Create new REST server

func (*Server) Shutdown

func (s *Server) Shutdown(timeout int)

Shutdown - Shutdown REST server

func (*Server) Start

func (s *Server) Start()

Start - Start REST server

type User

type User struct {
	Name       string            `json:"name"`
	Surname    string            `json:"surname"`
	Age        int               `json:"age"`
	BestMovies map[string]string `json:"bestMovies"` // key: genre - value: title
	Hobbies    []string          `json:"hobbies"`
}

WARN: remember to expose all fields externally, otherwise the json marshaler won't be able to find and use them

Jump to

Keyboard shortcuts

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