In the previous chapter, the Fortune Cookie quotes were part of the code file, and if you had to add a new quote, you would have to change the code file and redeploy the code. Redeploying the code in order to add a new quote is a maintenance nightmare. Typically, data is stored in a database because it allows you to insert new data without affecting the code. Having separation of concerns is an important architectural decision, where data concerns should be handled by the database and the code should be separate from the data. In this section, we will migrate the Fortune Cookie quotes out of the code and put them into Cosmos DB.
Why use Cosmos DB? The following are just some of the reasons:
- NoSQL database: There is no schema, making it easy to design the database based on JSON.
- Highly available: Service level agreement guarantees 99.99% uptime.