trailpack-spotify-api

1.0.0 • Public • Published

trailpack-spotify-api

NPM version Build status Dependency Status Code Climate

Trailpack to connect your app with the Spotify API

Install

$ npm install --save trailpack-spotify-api

Configure

// config/main.js
module.exports = {
  packs: [
    // ... other trailpacks
    require('trailpack-spotify-api')
  ]
}
// config/spotify.js
module.exports = {
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret'
}

How to use the API

This package is a wrapper for the 'spotify-web-api-node', the functions reference is available at here.

Usage example:

// api/services/spotify.js
module.exports = class SpotifyService extends Service {
 
  /**
   * Get Elvis' albuns
   */
  getElvisAlbuns() {
    return this.app.spotifyApi.getArtistAlbums('43ZHCT0cAZBISjO8DG9PnE')
  }
}

You can also access user private information using 'trailpack-passport' with Spotify OAuth2 to authentication workflow and obtain the access token.

Package Sidebar

Install

npm i trailpack-spotify-api

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • ianvieira