Skip to content

v1.1.1

Choose a tag to compare

@Programador-jr Programador-jr released this 06 Jan 01:02
· 139 commits to main since this release
a6e9dd3

Release Note - Exercise API

Version: 1.1.1

What's New

  1. 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).
  2. 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.jpg
      • https://libapi.vercel.app/exercises/3_4_Sit-Up/1.jpg

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