This repository contains two implementations of a simple API for the "Say Hello to APIs" workshop. Both implementations demonstrate the same functionality, one using Python with Flask and the other using Node.js with Express.
.
├── js-api/
│ ├── app.js # Node.js Express API implementation
│ ├── README.md # Instructions for running the Node.js API
├── py-api/
│ ├── app.py # Python Flask API implementation
│ ├── README.md # Instructions for running the Flask API
└── README.md # Root README file (this file)
-
Health Check Endpoint
- Verifies if the server is running.
-
Get Drinks Endpoint
- Retrieves a list of drinks or filters drinks based on a query parameter.
-
Add Drink Endpoint
- Allows adding a new drink by sending JSON data in a
POST
request.
- Allows adding a new drink by sending JSON data in a
-
Restricted Access Endpoint
- Simulates restricted access with a
403 Forbidden
response.
- Simulates restricted access with a
- For Python Flask: Python 3.7 or higher
- For Node.js Express: Node.js v14 or higher
-
Navigate to the
py-api
directory:cd py-api
-
Follow the instructions in
py-api/README.md
to set up and run the Flask API.
-
Navigate to the
js-api
directory:cd js-api
-
Follow the instructions in
js-api/README.md
to set up and run the Express API.
- Use tools like
curl
orPostman
to test the APIs. - Endpoints for both APIs are identical, ensuring consistent demonstration across platforms.
Feel free to fork this repository and submit pull requests to enhance or modify the APIs.