1.0.0 • Published 7 years ago
trailpack-spotify-api v1.0.0
trailpack-spotify-api
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.
1.0.0
7 years ago