rest

package
v0.0.0-...-5b9f10b Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFizzRouter

func NewFizzRouter(httpConfig *HttpConfig, srvName string, srvVersion string, isDebug bool) *fizz.Fizz

Types

type ErrorMessage

type ErrorMessage struct {
	Message string `json:"message"`
	Details string `json:"details,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error,omitempty"`
}

type ExtJson

type ExtJson struct {
	Data   interface{}
	Indent bool
}

func (ExtJson) Render

func (r ExtJson) Render(w http.ResponseWriter) (err error)

Render (JSON) writes data with custom ContentType.

func (ExtJson) WriteContentType

func (r ExtJson) WriteContentType(w http.ResponseWriter)

writeContentType (JSON) writes JSON ContentType.

type HttpConfig

type HttpConfig struct {
	Port int         `default:"8080" envvar:"SERVICE_PORT"`
	Cors cors.Config `default:"{\"AllowOrigins\": [\"http://localhost\", \"https://localhost\", \"*\"]}"`
}

type HttpError

type HttpError struct {
	HttpCode int
	Message  string
}

func (HttpError) Error

func (g HttpError) Error() string

type PingResponse

type PingResponse struct {
	Message string `json:"message"`
	Service string `json:"service"`
}

Jump to

Keyboard shortcuts

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