Requires the Go programming language binaries with the GOPATH
environment variable specified and $GOPATH/bin
in your PATH
.
go get github.com/unchartedsoftware/veldt-api
NOTE: Requires Go version 1.11+.
Clone the repository outside of your $GOPATH
:
git clone [email protected]:unchartedsoftware/veldt-api.git
cd veldt-api
Install dependencies
make install
This package provides HTTP and WebSocket handlers to connect the on-demand tile-based analytics of veldt to HTTP and WebSocket endpoints.
package main
import (
"github.com/zenazn/goji"
"github.com/unchartedsoftware/veldt-api/http"
"github.com/unchartedsoftware/veldt-api/middleware"
"github.com/unchartedsoftware/veldt-api/ws"
)
func main() {
// Mount logger middleware
goji.Use(middleware.Log)
// Mount gzip middleware
goji.Use(middleware.Gzip)
// Meta websocket handler
log.Infof("Meta WebSocket route: '%s'", ws.MetaRoute)
goji.Get(ws.MetaRoute, ws.MetaHandler)
// Tile websocket handler
log.Infof("Tile WebSocket route: '%s'", ws.TileRoute)
goji.Get(ws.TileRoute, ws.TileHandler)
// Meta request handler
log.Infof("Meta HTTP route: '%s'", http.MetaRoute)
goji.Post(http.MetaRoute, http.MetaHandler)
// Tile request handler
log.Infof("Tile HTTP route: '%s'", http.TileRoute)
goji.Post(http.TileRoute, http.TileHandler)
// Start the server
goji.Serve()
}