recommendations.ts

import { apiPrefix } from '../../utility/constants/app';
import { getRecommendations } from '../fetch/recommendations';
import middlewares from '../helper/middlewares';
import recommendationsMapper from '../mapper/recommendations';

export default async function recommendationsEndpoints(app) {
  app.get(`${apiPrefix}/recommendations`, middlewares, async (req, res) => {
    const result = await getRecommendations(req);
    const recommendations = recommendationsMapper(result);
    res.json(recommendations);
  });
}