Skip to content

API programmed in Python with FastAPI framework utilizing Cosmos DB as means of persistence

Notifications You must be signed in to change notification settings

hvalfangst/azure-cosmosdb-fastapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python API with Azure Cosmos DB

Requirements

Allocate resources

The script up provisions Azure resources by applying our Terraform script.

Configure Cosmos DB

Env file

After resources have been provisioned, one has to create a file named .env_cosmosdb in the root of this project which contains necessary information in order to access our newly provisioned Cosmos DB account such as connection string, database and container name. These fields will be mapped to our cosmos config.

screenshot

Connection string

The connection string may be retrieved from Azure at Settings->Keys for your Cosmos DB account.

screenshot

Running API

python -m uvicorn app.main:app --reload

Deallocate resources

The script down removes provisioned Azure resources running terraform destroy.

Postman collection

A collection of sample request has been included under the postman directory.

About

API programmed in Python with FastAPI framework utilizing Cosmos DB as means of persistence

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published