Data definition – RecommendationService

Let's begin the technical development of our RecommendationService microservice by creating a container with the database that will be used. In the case of our microservices, we will use a database based on graphs—the Neo4j. The behavior of this database is very interesting, besides being easy to implement, thus being a perfect example for our application.

In our docker-compose.yml file, we make a small change by adding Neo4j to our stack:

    recommendation_db:      image: neo4j:latest      ports:        - "7474:7474"        - "7687:7687"      environment:        NEO4J_AUTH: "none"

With this simple particle of code, we already have an instance of Neo4j inside a Docker container.

Get Microservice Patterns and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.