Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

242
Vistas
Why i cannot get a JSON response data in Javascript? with axios+express

I'm trying to get the lyrics as a response to this simple lyrics request (of an Eminem song for example) , it doesn't give me any errors but I don't understand why I'm not getting the response. What am i missing? Please help me :)

app.get('/lyrics', function(req, res)
{
  axios.get('https://api.lyrics.ovh/v1/eminem/stan')
    .then(function(data)
    {
      let result = {
        lyrics : data['lyrics'],
      };
      res.status(200).send(result);
    })
    .catch(function(err)
    {
      if(err['statusCode'] == 404)
        res.send({error : {status : 404, message : 'Lyrics not found'}});
      else
        res.send(err);
    })
    .then(function () {
    // always executed
    });
});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

As Phil Mentioned, Edit your code to this and you'll be fine

app.get('/lyrics', function(req, res)
{
  axios.get('https://api.lyrics.ovh/v1/eminem/stan')
    .then(function(data)
    {
      let result = {
        lyrics : data.data.lyrics,
      };
      res.status(200).send(result);
    })
    .catch(function(err)
    {
      if(err['statusCode'] == 404)
        res.send({error : {status : 404, message : 'Lyrics not found'}});
      else
        res.send(err);
    })
    .then(function () {
    
    });
});
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda