Tasks Completed:
- Created an API which takes pincode as a query parameter and returns the city and state as a result.
- Created a Address Form which takes the input as Zipcode and automatically fills the City and State fields corresponding to the code entered.
- Finally Stored the Data submitted by the user in the database.
Clone repository
git clone https://github.com/Ayush5120/Assignment1.git
Traverse to app directory
cd Form
Deploy MongoDB container Ensure you have the following software installed:
- Docker (version 20.10.12) or higher
Start MongoDB Container
docker pull mongo
docker create -it --name MongoTest -p 27017:27017 mongo
docker start MongoTest
Create Virtual environment (optional)
virtualenv env
source env/bin/activate
Make sure to be in Forms folder
pip install -r requirements.txt
python3 app.py
Visit the Address Form at
http://localhost:5001/forms
To use the Pincode API:
Get the state,city corresponding to the zip code by passing query parameter as shown:
http://localhost:5001/pincodes?pin=121004