A simple Django REST Framework API with JWT authentication for managing books and reviews.
- Clone the repository and navigate to the backend folder.
- Create a virtual environment
- Install the dependencies via
pip install -r requirements.txt
- Run migrations via
python manage.py migrate
- Start the development server via
python manage.py runserver
- Access the API docs using
http://127.0.0.1:8000/swagger/
- POST
/api/auth/register/
-> Register a new user- Inputs: username and password
- POST
/api/auth/login/
-> Login and get JWT tokens- Inputs: username and password
- Use the
access
token in your Auth headers to use the books and reviews endpoints
- GET
/api/books/
-> List all books - POST
/api/books/
-> Create a new book- Inputs: title, author, published_date (yyyy-mm-dd)
- GET
/api/books/{book_id}/
-> Retrieve a book - PATCH
/api/books/{book_id}/
-> Update a book - DELETE
/api/books/{book_id}/
-> Delete a book
- GET
/api/books/{book_id}/reviews/
-> List reviews for a book - POST
/api/books/{book_id}/reviews/
-> Add a review to a book- Inputs: rating (1-5), comment
- GET
/swagger/
-> Swagger UI (API Documentation)
Note: All endpoints (except register/login) require JWT authentication (Authorization: Bearer <access_token>)