diff --git a/dist/start.js b/dist/start.js index b9c9b54..776cbc4 100644 --- a/dist/start.js +++ b/dist/start.js @@ -34,9 +34,11 @@ const apiCache = { }; app.get("/getMostRecentSpotifyTrack", async function (req, res) { + console.log(apiCache.get("getMostRecentSpotifyTrack")); if (apiCache.get("getMostRecentSpotifyTrack")) { res.send(JSON.stringify(apiCache.get("getMostRecentSpotifyTrack"))); } else { + console.log("new") const lastfmResponse = await fetch( `http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=jdf221&api_key=${process.env.LASTFM_API_KEY}&format=json` ).then((res) => res.json()); @@ -49,13 +51,14 @@ app.get("/getMostRecentSpotifyTrack", async function (req, res) { const track = lastfmResponse?.["recenttracks"]?.["track"]?.[0]; response.track = track?.name; response.artist = track?.artist?.["#text"]; + console.log(response) apiCache.set("getMostRecentSpotifyTrack", response); res.send(JSON.stringify(response)); } }); -app.listen(3000);`2` +app.listen(3000); async function getSpotifyApi() { return {