Is it possible to pass data from Vuex Store to serverMiddleware in Nuxt.js?
async SET_DATA({commit}, payload) {
await this.$axios.$post('/api', { data: payload.data})
commit('SET_DATA', payload.data)
}
In nuxt.config
serverMiddleware: [
{ path: '/api', handler: '~/api/index' }
]
Then how do I access the data in api/index.js ?
export default function (req, res, next) {
// Get data from Store here
next()
}