const request = require("request");


module.exports.getRecommendation = function getRecommendation(name, id, cb) {
    let options = {
        method: 'GET'
    };

    switch (name) {
        case 'movies':
            options.url = "http://localhost:3033";
            break;
        case 'music':
            options.url = "http://localhost:3031";
            break;
        case 'books':
            options.url = "http://localhost:3032";
            break;
    }

    options.url += "/recommendations/" + id;

    request(options, function (error, response, body) {
        if (error) {
            return cb(error);
        }

        cb(null, body);
    });
};