1
0
mirror of synced 2025-12-21 19:06:49 -05:00
Files
docs/middleware/next.js
Mike Surowiec 6bc50f7e30 fix: filter hidden pages from the currentProductTree (SidebarProduct) (#20404)
* fix some async test things

* allow eslint to parse top-level awaits

* fix: filter out hidden pages closer to SidebarProduct usage
2021-07-20 12:32:35 -04:00

19 lines
467 B
JavaScript

import next from 'next'
const { NODE_ENV } = process.env
const isDevelopment = NODE_ENV === 'development'
export const nextApp = next({ dev: isDevelopment })
export const nextHandleRequest = nextApp.getRequestHandler()
await nextApp.prepare()
function renderPageWithNext(req, res, next) {
if (req.path.startsWith('/_next') && !req.path.startsWith('/_next/data')) {
return nextHandleRequest(req, res)
}
return next()
}
export default renderPageWithNext