This is a simple Flask project that provides a basic RESTful API for managing doctor appointments. The application allows users to retrieve a list of doctors, obtain information about a specific doctor, and book appointments with doctors.
-
Make sure you have Python installed on your machine.
-
Install the required dependencies by running the following command in your terminal:
pip install Flask
-
Clone this repository to your local machine:
git clone https://github.com/archelaus/flask-doctor-appointment.git
-
Navigate to the project directory:
cd flask-doctor-appointment
-
Run the Flask application:
python app.py
The application will be accessible at http://127.0.0.1:5000/.
- Endpoint:
/doctors
- Method:
GET
- Description: Retrieve a list of doctors.
- Endpoint:
/doctors/<int:id>
- Method:
GET
- Description: Retrieve information about a specific doctor by providing their ID.
-
Endpoint:
/book
-
Method:
POST
-
Description: Book an appointment with a doctor.
-
Parameters:
id
(int): Doctor's ID.day
(string): Appointment day (Monday-Saturday).time
(string): Appointment time (15:00-21:00).
-
Example Request:
curl -X POST -d "id=23&day=Monday&time=15:00" http://127.0.0.1:5000/book
-
Example Response:
Your appointment with Dr. Shaun Murphy for Monday at 15:00 has been successfully booked.
or
Invalid day selected. Please pick a day between Monday-Saturday.
-
-
The application uses in-memory data for demonstration purposes. In a real-world scenario, you would replace this with a database.
-
Make sure to handle security considerations (e.g., input validation, authentication, and authorization) before deploying this application in a production environment.