MCPcopy Index your code
hub / github.com/github/docs / productGroups

Function productGroups

middleware/contextualizers/product-groups.js:20–32  ·  view source on GitHub ↗
(req, res, next)

Source from the content-addressed store, hash-verified

18}
19
20export default async function productGroups(req, res, next) {
21 // It's important to use `req.pathPage` instead of `req.path` because
22 // the request could be the client-side routing from Next where the URL
23 // might be something like `/_next/data/foo/bar.json` which is translated,
24 // in another middleware, to what it would equate to if it wasn't
25 // client-side routing.
26 if (isHomepage(req.pagePath)) {
27 const { pages } = await warmServer()
28 req.context.productGroups = getProductGroups(pages, req.language)
29 }
30
31 return next()
32}

Callers

nothing calls this directly

Calls 4

getProductGroupsFunction · 0.90
isHomepageFunction · 0.85
warmServerFunction · 0.85
nextFunction · 0.50

Tested by

no test coverage detected