Releases: Programador-jr/MuscleLibAPI
v1.1.2
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.
- The issue was resolved by replacing
Localized Logs (EN and PT)
-
Improvement Added:
The API now adapts its error logs and internal messages to the language specified in thelang
parameter (en
orpt
).- If
lang=en
: Logs are displayed in English. - If
lang=pt
: Logs are displayed in Portuguese.
- If
-
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
- PT:
This update enhances the developer experience by providing clearer logs and resolving a critical issue in the search endpoint.
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.jpg
https://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
v1.1.0
Release Note - Exercise API
Version: 1.1.0
New Features
-
Added multilingual support (
en
andpt
):- Routes now accept the
lang
parameter to determine the language of the returned information. - Default language set to
en
(English) if thelang
parameter is not specified.
- Routes now accept the
-
Paginated Listing Route:
- Endpoint:
/api/exercises
- Pagination support with
page
andlimit
parameters. - Example usage:
GET /api/exercises?lang=pt&page=0&limit=50
- Endpoint:
-
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.
- Endpoint:
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.
v0.0.1
What's Changed
- Requisições simples pelo metodo GET
Full Changelog: https://github.com/Programador-jr/ExerciseApi/commits/1.0