im trying to access Nuxt runtime variables from a serverMiddleware
Example i have this context.$db which i added from this plugin
nuxt.config.js:
plugins: [
{ src: '~/plugins/db_runtime.js', mode: 'server' }
]
~/plugins/db_runtime.js:
db = 'test'
export default ({ app }, inject) => {
inject('db', db)
}
Then i added a serverMiddleware:
serverMiddleware: [
{ path: '/api', handler: '~/api/index.js' },
],
The serverMiddleware: ~/api/index.js:
export default function(res, req) {
}
Is there anyway to access context.$db from there? i.e
export default function(res, req) {
$config.db = null
}