planetfall

package module
v0.0.0-...-638794c Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: MIT Imports: 9 Imported by: 0

README

Server utils

Encapsulate GCloud features for App Engine

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Route

type Route struct {
	Endpoint string
	Handler  func(w http.ResponseWriter, r *http.Request)
	Methods  []string
}

type Server

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

need the following services activate in console: - Secret Manager - Error Reporting

func NewServer

func NewServer(
	projectID string, serviceName string,
	routeList []Route,
) (*Server, error)

func (*Server) Close

func (s *Server) Close()

func (*Server) GetSecret

func (s *Server) GetSecret(secretName string) (string, error)

func (*Server) InternalServerError

func (s *Server) InternalServerError(w http.ResponseWriter, r *http.Request, err error, message string)

Behavior to use when an error in encountered in a http handler Returns the message as a response to the request performer Log the message, the error, and the request using the Error Reporting tool from GCloud

func (*Server) JsonResponse

func (s *Server) JsonResponse(w http.ResponseWriter, r *http.Request, v interface{})

Returns an object as a JSON response

func (*Server) Listen

func (s *Server) Listen(addr string)

Jump to

Keyboard shortcuts

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