Nozioni di base del routing basato sul file system
Comprenda i concetti fondamentali del routing basato sul file system in Next.js e come creare pagine e route di base.
Nozioni di base del routing basato sul file system è una lezione Next.js 15 Fullstack (App Router + Server Actions) gratuita su CoddyKit. Questa è la lezione 2 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Next.js 15 Fullstack (App Router + Server Actions), e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Next.js 15 Fullstack (App Router + Server Actions) include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
Intro to File-System Routing
Next.js routes by your file system — your folder and file layout directly defines your URLs. Files become pages, folders become URL segments.
The Core `app` Directory
Every route lives inside the special app directory — the root of your site's structure. Anything you put there shapes the routing.
Creating a Root Page
A route needs a page.js that default-exports a React component. Place it directly in app/ and it becomes your homepage at /.
Hello Next.js Homepage!
Here's a minimal app/page.js. This component renders at your root URL / — the homepage visitors land on first.
export default function HomePage() {
return (
<div>
<h1>Welcome to CoddyKit!</h1>
<p>This is your Next.js homepage.</p>
</div>
);
}Folders for Nested Paths
Want a /dashboard route? Make a dashboard folder in app/ and drop a page.js inside. The folder name becomes the URL segment.
The Dashboard Page
This code goes in app/dashboard/page.js. Visit /dashboard and Next.js renders exactly this component.
export default function DashboardPage() {
return (
<div>
<h1>Your Dashboard</h1>
<p>Here you'll find all your important stats.</p>
</div>
);
}Deeper Nested Routes
Nest as deep as you like — each folder adds a URL segment. So app/products/electronics/page.js maps to /products/electronics. Clean and logical.
Shared UI with `layout.js`
A layout.js defines shared UI that wraps the pages in its folder — perfect for nav bars, footers, and sidebars that stay put across routes.
Route Mapping Quiz
Imagine you have a file located at app/blog/posts/page.js within your Next.js project. What URL path would this file correspond to?
File-System Routing Recap
Recap: the app directory roots all routes, page.js defines a route's UI, folders create nested segments, and layout.js shares UI across them.
Domande Frequenti
La lezione «Nozioni di base del routing basato sul file system» è gratuita?
Sì — il testo completo di «Nozioni di base del routing basato sul file system» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Next.js 15 Fullstack (App Router + Server Actions), passa a CoddyKit PRO. Il corso Next.js 15 Fullstack (App Router + Server Actions) include 4 lezioni in totale.
Cosa imparerò in «Nozioni di base del routing basato sul file system»?
Comprenda i concetti fondamentali del routing basato sul file system in Next.js e come creare pagine e route di base. Eserciti Next.js 15 Fullstack (App Router + Server Actions) con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare Next.js 15 Fullstack (App Router + Server Actions)?
Non è richiesta alcuna esperienza precedente. Next.js 15 Fullstack (App Router + Server Actions) su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 2 di 4.
Quanto tempo richiede la lezione «Nozioni di base del routing basato sul file system»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione Next.js 15 Fullstack (App Router + Server Actions)?
Sì. Ogni lezione Next.js 15 Fullstack (App Router + Server Actions) include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Configurazione del progetto e CLI
- Nozioni di base del routing basato sul file system
- Panoramica di pagine e layout
- Stilizzazione della Sua app Next.js