Prototype a basic RESTful API using Python and Django Rest Framework.
Method | Endpoint | Description |
---|---|---|
GET | /todos/ |
Fetches the entire list of todos |
GET | /todos/?completed=<value> |
Fetches a list of completed todos |
GET | /todos/?search=<q> |
Fetches todos with tasks containing the provided phrase |
POST | /todos/ |
Creates a todo |
PATCH | /todos/<pk>/ |
Updates a todo |
DELETE | /todos/<pk>/ |
Deletes a todo |
- Clone this Github repo in your IDE of choice
- Create a virtual environment
python3 -m venv .venv source .venv/bin/activate
- Install project dependencies
pip install -r requirements.txt
- Create and initialize the database
python manage.py migrate
python manage.py runserver
python manage.py test
- Create a superuser
python manage.py createsuperuser
- Start the development server (see instructions above)
- Go to
http://127.0.0.1:8000/admin/
in your browser and login using the superuser credentials created during Step 1.
- The Django secret key is hard-coded rather than being stored as an environment variable outside of version control.
- The default SQLite database was used in lieu of Postgres or another more robust database management system.
- Endpoints are unprotected and all todos are shared as if only a single User would interact with this API.
Note: This list is not comprehensive.