rest

package module
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: MIT Imports: 5 Imported by: 0

README

gapp-rest

gapp

This library intent to provide a flexible and opinionated structure to build applications in a way that removes the problems of coding the same functionalities over and over regarding system components as configuration or logging.

Is the opinion of the library that the application scaffolding should revolve around the idea of a service container, seen in other types of frameworks. This container is responsible for storing factories of the application services that should be called for service instantiation, per need. This facilitates not only the composition of the application, but also directs the application architecture for a more dependency injection way of structuring services. By following this decoupled way of writing the application. will enable for more scalable and maintainable testing and production code.

Documentation

Index

Constants

View Source
const (
	// ContainerID defines the gapp-rest package container entry id
	// base string.
	ContainerID = "gapp.rest"

	// ContainerEngineID defines the default id used to register the
	// application gin engine instance in the application container.
	ContainerEngineID = ContainerID + ".engine"
)
View Source
const (
	// Env defines the gapp-rest package environment entry id base string.
	Env = gapp.Env + "_REST"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application interface {
	gapp.Application
	Engine() Engine
	Run(addr ...string) error
}

Application interface used to define the methods of a servlet application.

func NewApplication

func NewApplication() Application

NewApplication used to instantiate a new rest application.

type Engine

type Engine interface {
	gin.IRoutes
	Delims(left, right string) *gin.Engine
	HandleContext(c *gin.Context)
	LoadHTMLFiles(files ...string)
	LoadHTMLGlob(pattern string)
	NoMethod(handlers ...gin.HandlerFunc)
	NoRoute(handlers ...gin.HandlerFunc)
	Routes() (routes gin.RoutesInfo)
	Run(addr ...string) (err error)
	RunFd(fd int) (err error)
	RunListener(listener net.Listener) (err error)
	RunTLS(addr, certFile, keyFile string) (err error)
	RunUnix(file string) (err error)
	SecureJsonPrefix(prefix string) *gin.Engine
	ServeHTTP(w http.ResponseWriter, req *http.Request)
	SetFuncMap(funcMap template.FuncMap)
	SetHTMLTemplate(tpl *template.Template)
}

Engine interface for the gin-gonic engine object.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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