Skip to content

Releases: Programador-jr/MuscleLibAPI

v1.1.2

08 Jan 17:58
0293efb
Compare
Choose a tag to compare

Release Notes: API MuscleLib v1.1.2


Bug Fix in Search Endpoint

  • Identified Issue:
    A bug in the /api/exercises/search endpoint caused failures when processing search queries due to an undefined variable (formattedExercises), leading to inconsistent API responses.

  • Fix Implemented:

    • The issue was resolved by replacing formattedExercises with the correct variable name (matchedExercises), ensuring that search results are returned as expected.

Localized Logs (EN and PT)

  • Improvement Added:
    The API now adapts its error logs and internal messages to the language specified in the lang parameter (en or pt).

    • If lang=en: Logs are displayed in English.
    • If lang=pt: Logs are displayed in Portuguese.
  • Benefits:

    • Easier error interpretation for developers in different languages.
    • Improved consistency with the language used in the API requests.

Updated Usage Example

  • Search Request:

    GET https://libapi.vercel.app/api/exercises/search?lang=pt&query=crucifix
  • Corresponding Log:

    • PT: Nenhum exercício encontrado para o termo: crucifix
    • EN: No exercises found for the term: crucifix

This update enhances the developer experience by providing clearer logs and resolving a critical issue in the search endpoint.

v1.1.1

06 Jan 01:02
a6e9dd3
Compare
Choose a tag to compare

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

v1.1.0

04 Jan 16:37
a6e9dd3
Compare
Choose a tag to compare

Release Note - Exercise API

Version: 1.1.0

New Features

  1. Added multilingual support (en and pt):

    • Routes now accept the lang parameter to determine the language of the returned information.
    • Default language set to en (English) if the lang parameter is not specified.
  2. Paginated Listing Route:

    • Endpoint: /api/exercises
    • Pagination support with page and limit parameters.
    • Example usage:
      GET /api/exercises?lang=pt&page=0&limit=50
  3. Multilingual Search Route:

    • Endpoint: /api/exercises/search
    • Optimized search using Fuse.js library, which uses similarity logic to find matches.
    • The search language is determined by the lang parameter.
      Example:
      GET /api/exercises/search?lang=pt&query=crucifixo
    • If the language is not specified, the search is conducted in English.

Improvements

  • Language Validation: The API validates if the specified language (lang) is supported, returning an appropriate error if invalid.
  • Data Formatter: Implementation of a centralized function to format returned data based on the language (formatExercise), ensuring consistency in results.
  • Cleaner Structure:
    • Modularized code with reusable validations and formatting.
    • Clear error messages in case of issues in search or listing.

Next Steps

  • Implement pagination in the search route (/search) for large volumes of results.
  • Add support for more languages in the future.

Full Changelog

v0.0.1

24 Nov 17:08
a6e9dd3
Compare
Choose a tag to compare

What's Changed

  • Requisições simples pelo metodo GET

Full Changelog: https://github.com/Programador-jr/ExerciseApi/commits/1.0