Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCoreAPIToHandler ¶
func AddCoreAPIToHandler(handler Handler)
AddCoreAPIToHandler constructs an API for recipes
Types ¶
type APICallContext ¶
APICallContext is a facade for any concrete Context, e.g. gins
type DB ¶ added in v0.4.6
DB is the interface that all DB implementations have to expose
func NewDatabaseClient ¶ added in v0.4.6
NewDatabaseClient builds a client to communicate with a database
type Handler ¶
Handler is a facade for a HTTP handler and can be implemented by a concrete handler like gin.
func NewHandler ¶
func NewHandler() Handler
NewHandler creates a handler for API calls with a pre-configured ADDRESS
type MongoClient ¶ added in v0.4.6
MongoClient to connect to the mongo database
func (*MongoClient) Close ¶ added in v0.4.6
func (m *MongoClient) Close() error
Close the connection to the database
func (*MongoClient) StartDB ¶ added in v0.4.6
func (m *MongoClient) StartDB() error
StartDB initializes the database connection
func (*MongoClient) StopDB ¶ added in v0.4.6
func (m *MongoClient) StopDB() (err error)
StopDB closes the connection to the db
type Routes ¶
type Routes interface { // Route is created to a specific set of endpoints Route(string) Routes // GET endpoint is added to the routes set and registers a corresponding handler GET(string, func(c *APICallContext)) // Path returns the base path Path() string // PATCH endpoint is added to the routes set and registers a corresponding handler PATCH(string, func(c *APICallContext)) // POST endpoint is added to the routes set and registers a corresponding handler POST(string, func(c *APICallContext)) // PUT endpoint is added to the routes set and registers a corresponding handler PUT(string, func(c *APICallContext)) // DELETE endpoint is added to the routes set and registers a corresponding handler DELETE(string, func(c *APICallContext)) }
Routes is managing a set of API endpoints. Routes implementation(s) call handler function to perform typical CRUD operations (GET, POST, PATCH, ...).
type Server ¶
type Server struct { Address string // contains filtered or unexported fields }
Server interface which extends the http.Server
func NewServer ¶
func NewServer() Server
NewServer creates a new server to listen on the defaultAddress
func NewServerA ¶
NewServerA creates a new server using a given address to listen to
func NewServerH ¶
NewServerH creates a new server using the default address with a custom handler
type Version ¶
type Version struct { // APP is the version of the current app App string `json:"app"` // API is the MAJOR API Version supported by the app API string `json:"api"` }
Version of the application and the exposed api
func AppVersion ¶
func AppVersion() *Version
AppVersion returns the current major version of the API as well as the applications version