These endpoints proxy requests to external APIs with CORS headers and authentication.
Collects reviews from Judge.me API for Alien Store
URL: https://judge.me/api/v1/reviews Parameters: api_token, shop_domain, rating
Fetches company data from InfoCUI API
URL: https://infocui.ro/system/api/data Parameters: key, cui
Fetches company financial data from InfoCUI API
URL: https://infocui.ro/system/api/finance Parameters: key, cui, year
Subscribes users to Klaviyo Canada list
URL: https://a.klaviyo.com/api/v2/list/UgFDvU/subscribe Parameters: api_key
Subscribes users to Klaviyo USA list
URL: https://a.klaviyo.com/api/v2/list/T9yCTT/subscribe Parameters: api_key
These endpoints handle internal operations with MongoDB and other services.
Retrieves current exchange rates
Collection: exchange_rates Operation: findOne
Retrieves wishlist data
Collection: wishlist Operation: findOne
Updates wishlist data
Collection: wishlist Operation: updateOne Body: JSON with filter and update data
Creates new wishlist entry
Collection: wishlist Operation: insertOne Body: JSON with document data
To add a new external API endpoint:
1. Open lib/api-endpoints.js
2. Add a new entry to the module.exports object:
'/your-endpoint/path': {
url: 'https://api.example.com/endpoint',
params: {
api_key: 'YOUR_ENV_VAR_NAME',
// other parameters
},
},
3. Add the corresponding environment variable to your .env file
To add new internal endpoints:
1. Create a new file in lib/ (e.g., your-project-endpoints.js)
2. Create a class that follows the pattern:
class YourProjectEndpoints {
constructor() {
this.endpoints = {
'/your-project/endpoint': {
handler: 'findOne', // or 'insertOne', 'updateOne', etc.
collection: 'your_collection',
},
};
}
async handleRequest(req, res) {
// Implementation similar to FyneJewelleryEndpoints
}
async testConnection() {
// Test your connection
}
}
3. Add the new router to lib/internal-endpoints-manager.js:
this.routers = [
new FyneJewelleryEndpoints(),
new YourProjectEndpoints(), // Add your new router
];
Required environment variables:
DOCUMENTATION_PASSWORD=your_secure_password MONGODB_URI=your_mongodb_connection_string ALIENSTORE_JUDGEME_API_TOKEN=your_token DISPOTRADING_INFOCUI_API_KEY=your_key PD_KLAVIYO_API_CANADA=your_key PD_KLAVIYO_API_USA=your_key