Loading repository data…
Loading repository data…
ajaymahadeven / repository
This repository contains a project that integrates Azure Functions with a PostgreSQL database using Python. It provides a set of API endpoints for managing a list of people, demonstrating how to deploy and run serverless functions with database connectivity on Azure.
This repository showcases a project integrating Azure Functions with a PostgreSQL database using Python. It provides a suite of API endpoints to manage a list of people, demonstrating the deployment and execution of serverless functions with database connectivity on Azure.
To successfully run this project, ensure you have the following:
You will need the following configuration files:
.env in the project root for Docker.env in the frontend folderlocal.settings.json in the api folder for Azure FunctionsSample configuration files are included in the repository.
Follow these steps to set up and run the project:
Clone the Repository
git clone <repository_url>
cd <repository_folder>
Start the PostgreSQL Database
In the project root, execute:
docker-compose up
Customize the database credentials in the docker-compose.yml file or directly via the .env file.
For Linux users:
Create a pgdata directory in the project root:
mkdir pgdata
Change the permissions and set the user and group of the pgdata directory to 1001:
sudo chown -R 1001:1001 pgdata
Set Up Azure Functions
Create a Python virtual environment in the project root and activate it:
python3 -m venv ./venv
source ./venv/bin/activate
Install Python Dependencies
From the project root, run:
python3 -m pip install -r requirements.txt
Deploy and Run Azure Functions
For the initial setup, deploy the functions to Azure by following these steps:
Press Fn + F5 to deploy the functions, or run the following command in the terminal:
func start
Follow the prompts to configure and debug the functions locally.
Access the Application
Open a browser and navigate to http://localhost:7071/api/hello to see the message "Hello, World!".
The following API endpoints are available:
http://localhost:7071/api/add_peoplehttp://localhost:7071/api/add_test_userhttp://localhost:7071/api/drop_peoplehttp://localhost:7071/api/peoplehttp://localhost:7071/api/hellohttp://localhost:7071/api/validate_userhttp://localhost:7071/api/add_user/api/hello endpoint to verify functionality.A Postman collection is available for testing the API endpoints:
This guide outlines the steps to clone the repository, set up the PostgreSQL database, configure Azure Functions, and access the API endpoints for testing and usage.