Execute function after response sent to client – express nodejs

execute-function-after-response-sent-to-client-–-express-nodejs

` app.use((req, res, next) => {
const originalEnd = res.end;

if (req.method !== "GET" && res.statusCode < 400) {
  res.end = function (chunk, encoding) {
    originalEnd.call(this, chunk, encoding);

    mainBuilder(); // function i want to execute
  };
}
next();

});
`

Explanation youtube video

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
the-mysterious-voyage-to-purple-planet

The Mysterious Voyage to Purple Planet

Next Post
unlock-the-power-of-ai-with-langchain:-the-future-of-language-model-applications

Unlock the Power of AI with LangChain: The Future of Language Model Applications

Related Posts