Is there some way how to log all network requests which are done by nuxtjs on server side?
I'm already using node --inspect
to enable chrome console, but network tab is missing there.
Thanks a lot for any tip.
I'm using axios nuxt plugin (https://axios.nuxtjs.org).
I've created a plugin to extend it (https://axios.nuxtjs.org/extend.html):
export default ({$axios, store}) => {
$axios.onResponse(response => {
console.log(`[${response.status}] ${response.request.path}`);
});
$axios.onError(err => {
console.log(`[${err.response && err.response.status}] ${err.response && err.response.request.path}`);
console.log(err.response && err.response.data);
})
}
onError()
logs errored requests onResponse()
logs successfull requestsHere is a sample output:
[200] /dashboard/rights/user
[200] /dashboard/rights/segment
[200] /dashboard/user/me
[400] /group/entries?group_id=undefined
{ status: 'error',
codeStatus: 400,
detail:
[ { message:
'"group_id" with value "undefined" fails to match the valid object id pattern',
path: 'group_id',
type: 'string.regex.name' } ] }
Hope it helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With