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

Function getServerSideProps

pages/search.tsx:23–46  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

21}
22
23export const getServerSideProps: GetServerSideProps<Props> = async (context) => {
24 const req = context.req as any
25 const res = context.res as any
26
27 const version = req.context.currentVersion
28
29 const searchVersion = searchVersions[Array.isArray(version) ? version[0] : version]
30 if (!searchVersion) {
31 // E.g. someone loaded `/en/enterprisy-server@2.99/search`
32 // That's going to 404 in the XHR later but it simply shouldn't be
33 // a valid starting page.
34 return {
35 notFound: true,
36 }
37 }
38
39 const mainContext = await getMainContext(req, res)
40
41 return {
42 props: {
43 mainContext,
44 },
45 }
46}

Callers

nothing calls this directly

Calls 1

getMainContextFunction · 0.90

Tested by

no test coverage detected