# Term Suggestion Gateway
- domain-specific term-suggestion services will be deployed in kubernetes manually.
- term-suggestion gateway will be deployed, able to route traffic to proper term-suggestion services, based on given shop_id/domain
### Overview
The gateway service maintains a list of term-suggestion deployments, and is able to route term-suggestion requests to proper deployments
In order to route traffic the gateway needs to maintain a routing table
| shop_id | domain | term_suggestion_url |
| -------- | -------- | -------- |
| abcd1 | sports | sports-term-suggestion.term-suggestion.svc.cluster.local |
| qwer1 | very | very-term-suggestion.term-suggestion.svc.cluster.local |
| asdf3 | sports | sports-term-suggestion.term-suggestion.svc.cluster.local |
each shop_id maps to a domain, shop_id is primary key
each domain maps to a term_suggestion_url, an implicit requirement is that one domain cannot map to multiple term_suggestion_url.
The routing will be generated from a given kubernetes cluster, where actual term-suggestion services are deployed.
### APIs
**POST /suggestion-term**
- JSON body
- shop_id
- domain
- query
- categories
- size
- proposed_term_suggestions
- applied_term_suggestions
- return 200 if everything works as expected
- return ERROR if
- shop_id/domain not found
- shop_id and domain conflicts
- term-suggestion service not found
- term-suggestion service errors
**POST /update**
- force update the routing table
**GET /shops**
- query params
- shop_id
- domain
**GET /domains**
- query params
- shop_id
- domain
### additional note
this could be implemented for generic purposes, but at this point it is unclear whether it is worth the effort.