Skip to main content
InterviewHubPRO
Section Overview
Q4

Question 4 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

8%
Astro Islands & SSR (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

How does File-Based Routing work in Astro (`src/pages/`)?

senior LevelRoutingAstro

In Simple Words: Astro uses the filesystem structure inside src/pages/ to generate routes:

  • src/pages/index.astro -> /
  • src/pages/about.astro -> /about
  • src/pages/blog/[slug].astro -> Dynamic route /blog/:slug
  • src/pages/api/checkout.ts -> Server endpoint API route returning JSON.