Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 1.26 KB

README.md

File metadata and controls

50 lines (37 loc) · 1.26 KB

Regommender

A simple recommender system API.

Usage

This project relies on Docker Compose for development and deployment.

The command below will spin up two docker containers. The first holds a Redis instance which serves as the backend for this project. The second holds the rest-api itself.

docker-compose up

The api is very simple. Currently it only supports two methods: set_recommendations and get_recommendations.

For setting a recommendation:

curl -X POST 'localhost:8080/recommendation/' -d '{
    "source": "product1",
    "target": "product2",
    "score": 0.78
}'

Then, you can get the recommendation by doing:

curl 'localhost:8080/recommendations/product1'
# ["product2"]

The recommendations are stored in sorted set objects rather than standard Redis keys, so Redis handle recommendations ordering automatically:

curl -X POST 'localhost:8080/recommendation/' -d '{
    "source": "product1",
    "target": "product2",
    "score": 0.78
}'

curl -X POST 'localhost:8080/recommendation/' -d '{
    "source": "product1",
    "target": "product3",
    "score": 0.95
}'

curl 'localhost:8080/recommendations/product1'
# ["product3","product2"]