This is a simple Django application showcasing RESTful API endpoints.
This application serves as a playground to learn and experiment with Django REST Framework.
-
Clone the repository:
git clone https://github.com/rifkiandriyanto/learn-django-rf cd learn-django-rf
-
Create a virtual environment and activate it:
python3 -m venv env source env/bin/activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Run the development server:
python manage.py runserver
- Endpoint:
/
- Method: GET
- Description: Retrieve data from the server.
- Endpoint:
/add/
- Method: POST
- Description: Add data to the server.
Use tools like cURL, Postman, or any HTTP client to interact with the API endpoints.
curl http://127.0.0.1:8000/
curl -X POST -H "Content-Type: application/json" -d '{"name": "item #1"}' http://127.0.0.1:8000/add/
Replace item #1
with the desired item name you want to add.