This Flask application provides a RESTful API for managing user information, including recruiters and job seekers.
- Get user information by email
- Retrieve all recruiters
- Retrieve all job seekers
- Get total user count
- Create new users
- Update user company information
- Delete users
- 🐍 Python
- 🌶️ Flask
- 🐘 PostgreSQL
- ☁️ AWS S3 (optional)
- 🐳 Docker
-
Install required packages:
pip install flask psycopg2-binary boto3
-
Configure the database connection in the script:
- Update
db_host
,db_port
,db_user
,db_password
, anddb_name
variables
- Update
-
(Optional) Configure AWS S3 for picture uploads:
- Uncomment and update S3 configuration variables
- Implement the
upload_to_s3
function
GET /userinfo/<email>
: Get user informationGET /userinfo/recruiters
: Get all recruitersGET /userinfo/jobseekers
: Get all job seekersGET /userinfo/total_count
: Get total user countPOST /userinfo
: Create a new userPUT /userinfo/<email>
: Update user's companyDELETE /userinfo/<email>
: Delete a user
- 📝 Request logging: Logs request information to
request_log.txt
- 📊 Response logging: Logs response information to
response_log.txt
To build and run the application using Docker:
-
View running Docker containers:
docker ps
-
Build the Docker image:
docker build -t userinfoms:latest .
-
Run the Docker container:
docker run userinfoms:latest
-
Run the Docker container with port binding:
docker run -p 5001:5001 userinfoms:latest
-
Stop all running Docker containers:
docker stop $(docker ps -q)
If you're not using Docker, you can run the application directly:
python app.py
The server will run on http://0.0.0.0:5001
in debug mode.
🔒 Ensure proper security measures are implemented before deploying this application in a production environment, especially regarding database credentials and AWS S3 configuration.