lastfm-nodejs-client
TypeScript icon, indicating that this package has built-in type declarations

1.5.2 • Public • Published

LastFm NodeJs client

NPM Version Downloads Per Week Codacy Badge License: MIT

A Node JS wrapper client for fetching public data from LastFm API.

Fetch server side or client side, thanks to cross-fetch

How to use the client

Install the npm package in your project.

pnpm install

Consider PNPM ▶️

Import it

Import the client module:

import { lastFm } from 'lastfm-nodejs-client';

Import the Types as type:

import type {
  Artist,
  Track,
  User,
  WeeklyAlbum,
} from 'lastfm-nodejs-client/dist/@types/lastfm.types';

Working on getting these into DefinitelyTyped

Use it

const lastFm = LastFmApi();
const { config, method } = lastFm;

const getTopArtists = async () => {
  const data = await lastFm.getTopArtists(
    method.user.top_artists,
    config.username,
    'overall',
    '200',
  );
  const { topartists } = data;
  return topartists;
};

🚀 Gives you:

user

Developing client

Written in TypeScript, compiles down to ES2015, provides the types for the lastFm entities.

Fork repo

gh repo fork mannuelf/lastfm-nodejs-client

What's gh? Get it here

Postman collections

A list of endpoints currently mapped to this client. Still under development, not feature complete.

View collections ▶️

ENV

Create .env file in project root:

You do not need an API key to query the public USER entity, add only base url and a username to env file.

LASTFM_API_BASE_URL=""
LASTFM_USER=""

For everything else you will need to include:

LASTFM_API_KEY=""
LASTFM_APPNAME=""

Create them here.

Develop

pnpm test
pnpm lint
pnpm lint-fix

Build

pnpm build

Publish

pnpm prepare
pnpm publish

Why I built this?

I was building a scrobbles page https://mannuelferreira.com/scrobbles and I thought others might want it to.

TODO

Dependencies (3)

Dev Dependencies (9)

Package Sidebar

Install

npm i lastfm-nodejs-client

Weekly Downloads

6

Version

1.5.2

License

MIT

Unpacked Size

80.3 kB

Total Files

103

Last publish

Collaborators

  • mannuelf