handler

package
v0.0.0-...-7e296ea Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Router  *mux.Router
	Session *gocql.Session
	Table   string
}

App represents the server application to handle HTTP/HTTPS requests.

func (*App) Healthcheck

func (a *App) Healthcheck(w http.ResponseWriter, r *http.Request)

Healthcheck is used as handler to requests whose objective is to check the application health. If the request is successful it means the server is ok, therefore the handler will respond confirm this status in its response.

func (*App) Initialize

func (a *App) Initialize(router *mux.Router, session *gocql.Session, table string)

Initialize gets the app ready for running, instantiating an HTTP router and a session to connect with a Cassandra cluster.

func (*App) Run

func (a *App) Run(addr string)

Run starts the application web server, serving http in a given address.

func (*App) TrackEvent

func (a *App) TrackEvent(w http.ResponseWriter, r *http.Request)

TrackEvent will read a HTTP request body and try to unmarshall its body into an Event structure. In case this operation is successful, the created Event will be stored

type Response

type Response struct {
	Code    int    `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

Response defines the response structure for the handler functions.

Jump to

Keyboard shortcuts

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