routes

package
v0.0.0-...-65594e8 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

routes defines HTTP handlers that can be used for API call

Files are refactored corresponding to db for more flexibility

Index

Constants

View Source
const (
	// APIURL is downstream proxy to run inference : "http://recommender-service:30000"
	APIURL string = "http://127.0.0.1:5000/api/v1"
)

Variables

This section is empty.

Functions

func Export

func Export(w http.ResponseWriter, r *http.Request)

Export dumps product_info to .csv

func GetAttributesTable

func GetAttributesTable(w http.ResponseWriter, r *http.Request)

GetAttributesTable passes list of attributes downstream

r.body : JSON

func GetCorpus

func GetCorpus(w http.ResponseWriter, r *http.Request)

GetCorpus passes infos from product_info table downstream to generate corpus. Future notes: Merge both Export and GetCorpus and add a URL argument for sets tasks

func GetProduct

func GetProduct(w http.ResponseWriter, r *http.Request)

GetProduct returns all value in data given product_id

func Health

func Health(w http.ResponseWriter, r *http.Request)

Health returns status of proxy and model health

func Infer

func Infer(w http.ResponseWriter, r *http.Request)

Infer receives given product_id and sends it downstream for inferences

func LogError

func LogError(w http.ResponseWriter, err error, msg string)

LogError returns and handles errors when met

func ResponseCSV

func ResponseCSV(w http.ResponseWriter, b *bytes.Buffer, filename string)

ResponseCSV returns response in csv file

func ResponseError

func ResponseError(w http.ResponseWriter, code int, message string)

ResponseError wraps around ResponseJSON to handles errors

func ResponseJSON

func ResponseJSON(w http.ResponseWriter, code int, payload interface{})

ResponseJSON processes normal JSON responses

Types

type HealthStatus

type HealthStatus struct {
	ProxyAlive  bool `json:"ProxyAlive"`
	StreamAlive bool `json:"StreamAlive"`
}

HealthStatus defines connection of inner proxy

Jump to

Keyboard shortcuts

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