I want to make a request to a logging service after serving the request. For eg you hit an endpoint '/hello' i want to increment count in redis but after serving the request. Something similar to res.on('final') in express.js.
I tried searching the docs to something similar to res.on('final') but can't find any solution.
Nuxt is usinig ofetch library. You can add a callback after the call is done and response is parsed https://github.com/unjs/ofetch#onresponse-request-options-response-
Also usable within useFetch() wrapper see in examples https://nuxt.com/docs/api/composables/use-fetch#example
If you consider using $fetch or any composable as wrapper like useFetch() consider this
https://nuxt.com/docs/api/utils/dollarfetch