If using express, hot server hot module reloading may not work after these steps
Express has its own route stack, so reloading require cache will not be enough to reload the routes inside express.
For hot module reloading with Express and Next.js, setting up a global callback to clear the Express route cache is required. This allows route updates to be recognized without server restarts.
add a global callback in _document.js
to clear the Express route cache during revalidation, allowing updated routes to be served without server restarts.