This project is part of a code screening assignment that demonstrates building a backend API using Django REST Framework and a responsive frontend using Vue.js. The backend provides an API for posts with comments, while the frontend displays movie details dynamically fetched from an external API.
-
Posts API:
- Fetch a list of posts ordered by timestamp (latest first).
- Display up to 3 comments per post, sorted by timestamp.
- Includes pagination for efficient data handling.
-
Random Comments Logic:
- Added a commented block of code for fetching 3 random comments instead of the latest.
-
Custom Pagination:
- Configurable page size to manage the number of posts displayed per page.
-
Testing:
- Tested using Postman for endpoints and data handling.
-
** Design**:
- A layout that that is adjusted for desktops (responsiveness - still learning).
-
Dynamic Data Fetching:
- Fetches movie details from the OMDB API.
- Displays data dynamically on the homepage.
-
Interactive Elements:
- Genre hover effects: Text switches to a genre-specific icon on hover.
- IMDb ratings displayed as a 5-star scale.
- Interactive icons for liking and adding to a watchlist with hover animations.
-
Key Improvement:
- Enhanced genre display with hover animations to improve visual appeal.
- Buffer loading screen that catches attention
- Python 3.10 or above
- Node.js and npm
- Vue CLI
-
Clone the repository:
git clone https://github.com/your-username/project-name.git cd backend_repo
-
Create and activate a virtual environment:
python -m venv env source env/bin/activate # On Windows: env\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Apply database migrations:
python manage.py migrate
-
Start the development server:
python manage.py runserver
-
Navigate to the frontend directory:
cd frontend
-
Install dependencies:
npm install
-
Start the development server:
npm run serve
- GET
/posts/
- Retrieves a paginated list of posts with up to 3 comments per post.
To fetch 3 random comments instead of sorting by timestamp, uncomment the provided logic in views.py
:
from random import sample
# Fetch 3 random comments instead of the latest
if comments.count() > 3:
random_comments = sample(list(comments), 3)
else:
random_comments = comments
project-name/
|-- backend_repo/
| |-- apps/
| | |-- demo/
| | |-- models.py
| | |-- serializers.py
| | |-- views.py
|-- frontend/
| |-- src/
| | |-- components/
| | |-- AppNavbar.vue
| | |-- AppHomepage.vue
| | |-- MovieDetailsCard.vue
| | |-- RatingsDisplay.vue
|-- README.md
- Use Postman or cURL to test the
/posts/
endpoint. - Example cURL command:
curl -X GET http://127.0.0.1:8000/posts/
- Open the application in a browser (
http://localhost:8080/
). - Test responsiveness by resizing the browser window.
Watch my project walkthrough on Loom: Loom Video Link
- Django REST Framework
- Vue.js
- OMDB API