Musixmatch Module for NuxtJS
NuxtJS module musixmatch API
The simplified NuxtJS module for request Musixmatch API support. Inspire by https://github.com/c0b41/musixmatch.
Request are pretty awesome, but I found myself using it into NuxtJS
Also check out here to using the methods that are very similar to request
📖 Release Notes
Setup
- Add
musixmatch
dependency to your project
yarn add musixmatch
- Add
musixmatch
to the modules
section of nuxt.config.js
{
modules: [
'musixmatch',
['musixmatch', { }]
]
}
Module Options
{
modules: [
'musixmatch'
],
musixmatch: {
apikey: '<Your Musixmatch API Key>'
baseURL: '<Musixmatch API version root URL>'
format: 'json'
corsURL: ''
proxyURL: ''
}
}
Quick Usage
Now you can use all Musixmatch services with $this.musixmatch
and followed by method
this.$musixmatch.chartArtists({ page: 1, page_size: 3, country: 'us'}).then(function (res) {
if (res != null) {
console.log(res.artist_list)
}
})
Methods
For more information how to use Methods and Params with example... please refer to https://github.com/c0b41/musixmatch#methods
Basic Example Configuration
- Using
https://cors-anywhere.herokuapp.com/
to prevent CORS problems
modules: [
'nuxt-musixmatch'
],
musixmatch: {
apikey: '<API Key>',
corsURL: 'https://cors-anywhere.herokuapp.com/'
},
- OR integrate to
@nuxtjs/axios
and Proxy Module to prevent CORS problems
modules: [
'@nuxtjs/axios',
'nuxt-musixmatch'
],
musixmatch: {
apikey: '<API Key>',
proxyURL: '/api/'
},
axios: {
proxy: true
},
proxy: {
'/api/': {
target: 'https://api.musixmatch.com/ws/1.1/',
pathRewrite: { '^/api/': '' }
}
},
License
MIT License
Copyright (c) IMAN
https://www.axfon.com
https://atel.us