I’m so excited to ‘introduce’ you to a new addition to Azure Cosmos DB service. At Ignite 2022, Microsoft made an announcement for PostgreSQL in Azure CosmosDB!
In this blog we will show you how to connect your Front end app to the Azure Cosmos DB for PostgreSQL service in Azure.
This is the beginning of a larger series so not all the features you see on the app are complete. We will walk this journey together as we add more production level of deployment into the repo. (Aka. Key-Vault for secrets, Managed Identity and Infrastructure As Code. :))
Azure Cosmos DB for PostgreSQL has combined these two technologies and extended with Citus extension to bring distributed tables for PostgreSQL. Combining Azure Cosmos DB’s high scalability and Citus’s distributed tables allows for maximum performance with PostgreSQL.
Once you clone the repo, go to ‘Server/db/citus.js’
Please replace ‘<cluster>’ and ‘<password>’ with the values you put in from the previous step.
Go to your favorite cli tool then go to the React folder and run:
You will see:
Now go to the Server folder and run:
‘Reset’ will create the table of Pharmacy in the Citus Database with seed data.
‘Load’ will load the dataset into the view.
‘DeleteAll’ will drop the table.
(I haven’t worked on the ‘Add Pharmacy’ and ‘Delete Selected’, YET, so they are disabled… lol)
It’s easy as that! You’ve created your first React app with Azure Cosmos DB for PostgreSQL.
I hope this set a good foundation for anyone to go start making something awesome!
Please be advised that Azure Cosmos DB’s cost could go up fast if you want to really leverage the full power of it’s scalability and multi-region support. (We always recommend using the Azure Pricing Calculator to get a transparent estimate)