Documentation ¶
Index ¶
Constants ¶
const ( FIZZBUZZ_RESOURCE_ROUTE = "/fizzbuzz" FIZZBUZZ_RESOURCE_NAME = "fizzbuzz" )
const ( STATS_RESOURCE_ROUTE = "/stats" STATS_RESOURCE_NAME = "stats" STATS_DB_COLLECTION_NAME = "access_events" )
Variables ¶
This section is empty.
Functions ¶
func FizzBuzzHandler ¶
FizzBuzzHandler godoc @Summary Return Fizzbuzz resource @Description get custom Fizzbuzz @Produce json @Param int1 query int true "int1 query parameter" @Param int2 query int true "int2 query parameter" @Param limit query int true "limit query parameter" @Param str1 query string true "str1 query parameter" @Param str2 query string true "str2 query parameter" @Router /fizzbuzz [get]
Types ¶
type APIHandler ¶
type APIHandler interface {
StatsHandler() gin.HandlerFunc
}
Handler interface for Api server
func NewAPIHandler ¶
func NewAPIHandler(db db.Client) APIHandler
NewAPIHandler create an api handler with injected db client
type APIMiddleware ¶
type APIMiddleware interface {
StatsMiddleware() gin.HandlerFunc
}
func NewAPIMiddleware ¶
func NewAPIMiddleware(db db.Client) APIMiddleware
New NewAPIMiddleware create an apiMiddleware with injected db client
type AccessEvent ¶
type AccessEvent struct { Resource string `bson:"resource"` Method string `bson:"method"` Date time.Time `bson:"date"` Uri string `bson:"uri"` Parameters map[string][]string `bson:"parameters"` }
AccessEvent represents a db document of the collection "access_event" holding all api access events
type ErrorResponse ¶
type ErrorResponse struct { Status int Errors []string `json:"errors,omitempty"` Message string `json:"message"` }
ErrorResponse
type Fizzbuzz ¶
type Fizzbuzz struct { Int1 int `schema:"int1,required"` Int2 int `schema:"int2,required"` Limit int `schema:"limit,required"` Str1 string `schema:"str1,required"` Str2 string `schema:"str2,required"` }
Fizzbuzz represents the resource payload
type Server ¶
type Server struct { Conf Config DBClient db.Client Router *gin.Engine Middleware APIMiddleware Handler APIHandler }
Server representing a web server and its dependeincies
func (*Server) InitServer ¶
func (s *Server) InitServer()
@title LeBonCoin test fizzbuzz @version 1.0 @description LeBonCoin test fizzbuzz @contact.name Momzor @contact.email m.benaida.pro@gmail.com @license.url https://www.gnu.org/licenses/quick-guide-gplv3.html