<commit_before>"use strict";

const express = require("express");
const app = express();

// install request
const request = require('request');

const PORT = process.env.PORT || 3000;
const rovi = process.env.ROVI_APIKEY || '';
const echo = process.env.ECHONEST_APIKEY || '';


// CORS (Cross-Origin Resource Sharing) headers to support Cross-site HTTP requests
app.all('*', function(req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "X-Requested-With");
    res.header("X-Frame-Options", "SAMEORIGIN");
    next();
});


// Request artist bio, photo, and discography from Rovi API
app.get('/api/:artist/:sig', (req, res) => {
  const artist = req.params.artist;
  const sig = req.params.sig;
  const url = "http://api.rovicorp.com/search/v2.1/music/search?apikey=" + rovi + "&sig=" + sig + "&query=" + artist + "&entitytype=artist&size=1&include=images,musicbio,discography,videos&formatid=62&type=main";

  request.get(url, (err, response, body) => {
    if (err) throw err;

    res.send(JSON.parse(body));
  });
});


// Request artist's video information from Echonest API
app.get('/videos/:artist', (req, res) => {<commit_msg>Add API route to get album art<commit_after>"use strict";

const express = require("express");
const app = express();

// install request
const request = require('request');

const PORT = process.env.PORT || 3000;
const rovi = process.env.ROVI_APIKEY || '';
const echo = process.env.ECHONEST_APIKEY || '';


// CORS (Cross-Origin Resource Sharing) headers to support Cross-site HTTP requests
app.all('*', function(req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "X-Requested-With");
    res.header("X-Frame-Options", "SAMEORIGIN");
    next();
});


// Request artist bio, photo, and discography from Rovi API
app.get('/api/:artist/:sig', (req, res) => {
  const artist = req.params.artist;
  const sig = req.params.sig;
  const url = "http://api.rovicorp.com/search/v2.1/music/search?apikey=" + rovi + "&sig=" + sig + "&query=" + artist + "&entitytype=artist&size=1&include=images,musicbio,discography,videos&formatid=62&type=main";

  request.get(url, (err, response, body) => {
    if (err) throw err;

    res.send(JSON.parse(body));
  });
});


// Request album information from Rovi API
app.get('/api/:albumId/:sig', (req, res) => {
  const albumId = req.params.albumId;
  const sig = req.params.sig;
  const url = "http://api.rovicorp.com/data/v1.1/album/images?apikey=" + rovi + "&sig=" + sig + "&albumid=" + albumId + "&imagesize=200-300x200-300";

  request.get(url, (err, response, body) => {
    if (err) throw err;

    res.send(JSON.parse(body));
  });
});


// Request artist's video information from Echonest API
app.get('/videos/:artist', (req, res) => {
{'fraction_non_alphanumeric': 0.1880281690140845, 'fraction_numerical': 0.011267605633802818, 'mean_word_length': 4.2224264705882355, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1001235', 'n_tokens_mistral': 1009, 'n_tokens_neox': 975, 'n_words': 217}