How to run code after requests in Next.js (to perform canonical logging and to flush logs)
Unanswered
Orinoco Crocodile posted this in #help-forum
Orinoco CrocodileOP
I want to log all requests to API endpoints, while adding some context while the endpoint is executing, eg (user_id=abcd123, api_key=id_asdf)
Tried middleware, but it doesn't run after the requests has finished running, so the canonical context is missing.
Tried middleware, but it doesn't run after the requests has finished running, so the canonical context is missing.