A simple HTTP API that returns the top track for the most recent week from Last.fm.
lastfm.ts - HTTP endpoint that fetches and returns the top track from the past 7 daysmain.ts - Empty placeholder fileReturns the most played track for user "pinjasaur" from the past 7 days.
Response Format:
{ "track": { "name": "Track Name", "artist": "Artist Name", "playcount": 42, "url": "https://www.last.fm/music/Artist/_/Track", "image": "https://lastfm.freetls.fastly.net/i/u/300x300/image.png" }, "period": { "from": "2026-01-09T16:50:28.000Z", "to": "2026-01-16T16:50:28.000Z" }, "user": "pinjasaur" }
Error Responses:
500 - API key not configured or Last.fm API error404 - No tracks found for the past weekRequires the LAST_FM_API_KEY environment variable to be set with a valid Last.fm API key.