MCPcopy Create free account
hub / github.com/github/docs / renderPageWithNext

Function renderPageWithNext

middleware/next.js:10–26  ·  view source on GitHub ↗
(req, res, next)

Source from the content-addressed store, hash-verified

8await nextApp.prepare()
9
10function renderPageWithNext(req, res, next) {
11 // We currently don't use next/image for any images.
12 // We don't even have `sharp` installed.
13 // This could change in the future but right now can just 404 on these
14 // so we don't have to deal with any other errors.
15 if (req.path.startsWith('/_next/image')) {
16 return next(404)
17 }
18
19 const isNextDataRequest = req.path.startsWith('/_next') && !req.path.startsWith('/_next/data')
20
21 if (isNextDataRequest) {
22 return nextHandleRequest(req, res)
23 }
24
25 return next()
26}
27
28export default renderPageWithNext

Callers

nothing calls this directly

Calls 1

nextFunction · 0.50

Tested by

no test coverage detected