When building any application, typically, we’ll need to deal with data or files and sometimes both. Microservices are no different. We need a database to store dynamic data that’s generated and updated by the application, and we need a place to store assets that are served by the application or uploaded to it.
In this chapter, we add both file storage and a database to our FlixTube example application. First, we’ll add file storage so FlixTube has a location to store its videos. We want to have distinct areas of responsibility in our application for streaming and video storage. That implies that we’ll need to add another microservice to our application, and in this chapter, we will indeed create our second microservice.
Then we’ll add a database. At this point, we add a database so that we have a place to record the path to each video, but this is really just an excuse to get a database in place. Because once we have it, we can easily use it to store all the metadata for our videos and to provide for the on-going data storage needs of all our microservices.