Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

218
Views
return response from a module from a call

So i have a function in a module, This is the Index file

const track = require('./components/trackPlays')
const Plays = track.Plays(username, expT ,expA )

this is the module file.

const axios = require('axios');
const keys = require('../../../../keys/lfmconfig.json')

const Plays = (f,t,a) => {
  const requestURL = `http://ws.audioscrobbler.com/2.0/?method=track.getInfo&api_key=${keys.apikey}&username=${f}&artist=${a}&track=${t}&format=json`
  axios.get(requestURL)
  .then((response) => {
    console.log(response.data.track.userplaycount) 
    return response.data.track.userplaycount
  })
}


exports.Plays = Plays

I want to use the value response.data.track.userplaycount in my index file but when i try to return it, it just returns undefined

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!