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