App Router — Series 3

Preview — 3 of 10 questions

A request comes in for /docs/advanced, which is not in the returned list. What happens?

javascript
// app/docs/[slug]/page.tsx
export const dynamicParams = false;

export function generateStaticParams() {
  return [{ slug: 'intro' }, { slug: 'setup' }];
}
A/docs/advanced returns a 404 — with dynamicParams = false, only the params from generateStaticParams are valid; any other value renders the not-found response instead of being rendered on demand
B/docs/advanced is rendered on demand and cached, same as the default behavior
CThe build fails because generateStaticParams must return every possible slug
D/docs/advanced renders but with params.slug set to undefined

What do these two route segment config exports control?

javascript
// app/api/geo/route.ts
export const runtime = 'edge';
export const preferredRegion = ['iad1', 'fra1'];
Aruntime sets the Node.js version; preferredRegion sets the database region
Bruntime picks a bundler (edge = Turbopack); preferredRegion is ignored outside Vercel
Cruntime selects the execution environment for this segment — 'nodejs' (default, full Node APIs) or 'edge' (lightweight, Web-standard APIs, faster cold starts); preferredRegion hints where Edge/serverless functions for this segment should run, e.g. close to your data
DBoth are build-time only and have no effect on where code runs

What does this matcher do?

javascript
// middleware.ts
export const config = {
  matcher: [
    {
      source: '/dashboard/:path*',
      has: [{ type: 'cookie', key: 'session' }],
      missing: [{ type: 'header', key: 'x-skip-mw' }],
    },
  ],
};
ANothing — has/missing are not valid matcher options
BRuns the middleware for /dashboard/* only when a session cookie is present and the x-skip-mw header is absent; requests failing either condition bypass middleware entirely
CRuns middleware for every request and then checks has/missing inside the function
DRedirects any /dashboard/* request that has a session cookie

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.