1.5.2 • Published 7 months ago

lastfm-nodejs-client v1.5.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

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

1.4.6

7 months ago

1.4.5

7 months ago

1.4.4

7 months ago

1.5.2

7 months ago

1.4.3

8 months ago

1.5.1

7 months ago

1.4.2

8 months ago

1.5.0

7 months ago

1.4.1

8 months ago

1.4.0

8 months ago

1.3.0

8 months ago

1.2.4

9 months ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago