Documentation ¶
Overview ¶
routes defines HTTP handlers that can be used for API call
Files are refactored corresponding to db for more flexibility
Index ¶
- Constants
- func Export(w http.ResponseWriter, r *http.Request)
- func GetAttributesTable(w http.ResponseWriter, r *http.Request)
- func GetCorpus(w http.ResponseWriter, r *http.Request)
- func GetProduct(w http.ResponseWriter, r *http.Request)
- func Health(w http.ResponseWriter, r *http.Request)
- func Infer(w http.ResponseWriter, r *http.Request)
- func LogError(w http.ResponseWriter, err error, msg string)
- func ResponseCSV(w http.ResponseWriter, b *bytes.Buffer, filename string)
- func ResponseError(w http.ResponseWriter, code int, message string)
- func ResponseJSON(w http.ResponseWriter, code int, payload interface{})
- type HealthStatus
Constants ¶
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 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