Repository navigation
v1.1.1
Release Note - Exercise API
Version: 1.1.1
What's New
-
Enhanced Image Organization:
- Exercise images are now structured in folders named after the respective exercises, simplifying access.
- Each folder contains images related to the exercise, sequentially numbered (e.g.,
0.jpg,1.jpg).
-
Direct Image Access via URL:
- Images can now be accessed directly using the endpoint
/exercises/{exerciseName}/{imageIndex}.jpg. - Example URLs:
https://libapi.vercel.app/exercises/3_4_Sit-Up/0.jpghttps://libapi.vercel.app/exercises/3_4_Sit-Up/1.jpg
- Images can now be accessed directly using the endpoint
Developer Impact
- Simplified Image Management: No need to store images in the database. They can be referenced directly through the API.
- Frontend Integration Ready: Images can be easily used in frontend projects, including dynamic implementations like alternating images to mimic a GIF.
Frontend Usage Example
if (exercise.images && exercise.images.length > 0) {
const img = document.createElement('img');
img.src = `https://libapi.vercel.app/exercises/${exercise.images[0]}`; // First image
img.alt = exercise.name;
document.body.appendChild(img);
// Image alternation
let currentIndex = 0;
setInterval(() => {
currentIndex = (currentIndex + 1) % exercise.images.length;
img.src = `https://libapi.vercel.app/exercises/${exercise.images[currentIndex]}`; // Update the image
}, 1500); // Switch every 1.5 seconds
}Full Changelog: 1.1...v1.1.1