What role does the 'pages' directory play in a Next.js application?
Instruction: Explain the significance and function of the 'pages' directory in Next.js.
Context: This question tests the candidate's familiarity with the structure of Next.js projects and the convention-over-configuration approach.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
The pages directory defines routes in the Pages Router. For example, pages/index.js maps to /, pages/about.js maps to /about, and pages/posts/[id].js describes a dynamic post route. Nested folders contribute URL segments. A normal page module exports the React component that renders that route.
Some files have special roles...