Unofficial Node.js API wrapper for the Dutch Aldi.
npm install aldi-wrapper
or
yarn add aldi-wrapper
then
import { Aldi } from 'aldi-wrapper';
// Creates Aldi object, set verbose to true to see all requests
const aldi = new Aldi({ verbose: true });
// Gets products by name
const products = await aldi.product().getProductsFromName('melk');
More information about the functions and parameters can be found on the wiki
For all of these examples, please keep in mind that your function in which you request something should be async
since the requests return a Promise
.
If I want to find all product names that match a given query:
import { Aldi } from 'aldi-wrapper';
async function findProducts(productName: string) {
const aldi = new Aldi();
const products = await aldi.product().getProductsFromName(productName);
console.log(
products.articles.map((article) => {
return article.title;
})
);
}
findProducts('karnemelk');
[ 'Karnemelk ', 'Biologische karnemelk', 'Karnemelkdessert' ]
If I want to find all recipe names that match a given query:
import { Aldi } from 'aldi-wrapper';
async function findRecipes(recipeName: string) {
const aldi = new Aldi();
const recipes = await aldi.recipe().getRecipesFromName(recipeName);
console.log(
recipes.recipes.map((recipe) => {
return recipe.title;
})
);
}
findRecipes('pizza');
[
'Pizza rolls gevuld met kip',
'Pizza met gehakt',
'Homemade pizza',
'Pizza met ansjovis',
'Gezonde Sinterklaas-snack: pizza toast met verstopte groenten',
'Pizza van Turks brood met hummus en gefrituurde aubergine',
'Vegetarische pizza',
'Mini bladerdeegpizza’s met tomatensaus, kaas en basilicum',
'Vier soorten zelfgemaakte bladerdeeghapjes '
]