{"size": 1137, "ext": "js", "max_stars_repo_path": "route/song-router.js", "max_stars_repo_name": "horoscope-generator/backend", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "route/song-router.js", "max_issues_repo_name": "horoscope-generator/backend", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "route/song-router.js", "max_forks_repo_name": "horoscope-generator/backend", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.7297297297, "max_line_length": 84, "alphanum_fraction": 0.5831134565}
'use strict';

const {Router} = require('express');
const jsonParser = require('body-parser').json();
// const Song = require('../model/song');
const superagent = require('superagent');
// const lyrics = require('song.json');
// let __API_URL__ = process.env.API_URL;

const songRouter = module.exports = new Router();

//++++++++++++++++++GET+++++++++++++++++++++++

songRouter.get('/lyrics', jsonParser, (request, response, next) => {

  superagent.get(`http://www.kanyerest.xyz/api/album/graduation`)
    .then(songObject => response.send(songObject.text),
      err => response.send(err)
    );
});


// songRouter.get('/lyrics', jsonParser, (request, response, next) => {
  
//     superagent.get(`http://www.kanyerest.xyz/api/album/graduation`)
//       .then(songObject => {
//         console.log('song object.result[0]', songObject.response.text.result[0]);
//         return new Song({
//           title: songObject.result[0].title,
//           lyrics: songObject.result[0].lyrics,
//         }).save();
//       })
//       .then(response => {
//         response.sendStatus(200);
//       })
//       .catch(next);
//   });