A lightweight sandbox project for learning how to build simple RESTful APIs using Flask.
It’s your playground to explore backend development fundamentals in Python 🚀
This project was built as a hands-on learning exercise to understand how APIs work under the hood.
The goal was to create a minimal yet functional backend capable of handling basic HTTP requests and returning JSON responses.
- 🧭 Basic routing in Flask
- ⚙️ Handling GET and POST requests
- 💬 Sending & receiving JSON payloads
- 🛠️ Setting up a local development environment
Follow these steps to get your local environment up and running 👇
Make sure you have the following installed:
- 🐍 Python 3.x
- 📦 pip
-
Clone the repository
git clone https://github.com/your-username/your-repository-name.git
-
Navigate to the project directory
cd your-repository-name -
Create and activate a virtual environment
-
On macOS/Linux:
python3 -m venv venv source venv/bin/activate -
On Windows:
python -m venv venv .\venv\Scripts\activate
-
-
Install dependencies
pip install -r requirements.txt
💡 To create
requirements.txt, run:
pip freeze > requirements.txtafter installing Flask.
Start the Flask development server:
flask runThe API will be live at 👉 http://127.0.0.1:5000
You can test endpoints using tools like curl or Postman.
Returns a simple welcome message.
curl http://127.0.0.1:5000/api/hello{
"message": "Hello! This is my first Flask API."
}Echoes back the JSON data sent in the request body.
curl -X POST -H "Content-Type: application/json" -d '{"name": "User", "data": "Some sample data"}' http://127.0.0.1:5000/api/echo{
"received_data": {
"name": "User",
"data": "Some sample data"
},
"status": "success"
}Distributed under the MIT License.
See the LICENSE file for more information.