Server middleware for after render process

Timkor
6
Timkor
commented 3 months ago

What problem does this feature solve?

Would be nice to run server middleware after the rendering process. For e.g. pushing data to analytics services or anti fraud systems. The user wouldn't need to wait for that.

What does the proposed changes look like?

nuxt.config.js:

{
    serverMiddleware: [
        {
            src: '~/server/middleware/anti-fraud.js',
            after: 'render'
        }
    ]
}
idea
0
pi0
29.8k
pi0
commented 3 months ago

You can use render:route hook (with args url, result, context) to intercept result and context which also contains req and res

0
Informations
Feature Request โ€ข Open
#c8984 - Created 3 months ago