From the course: Learning Next.js (2022)
Unlock the full course today
Join today to access over 24,000 courses taught by industry experts.
Building a file-based routing system
From the course: Learning Next.js (2022)
Building a file-based routing system
- [Instructor] Next.js has a file system built on the concept of pages. Whenever a new file is added to the pages directory, it automatically creates a new route. Everything happens behind the scene with a minimum of configuration. This is simple as that and it is also very simple to set up. Let's see how this works. So every new page must be added inside the directory pages. We already have the pages index at the route URL. This is the component of index.js which is visible at the route localhost 3000. Then we have the file hello.js which is available at localhost:3000/hello. Next we're going to create about.js which will then be available at the routes which will be automatically created behind the scene which is then going to be visible at localhost:3000/about. So we go back to the code editor and we're going to see how this works step-by-step with more examples. So that's going to be the same process which is to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Getting started with the Next.js tooling4m 54s
-
(Locked)
Creating new pages3m 36s
-
(Locked)
Building a file-based routing system3m 58s
-
(Locked)
Creating links to navigate between pages2m 55s
-
(Locked)
Setting up dynamic routing and URLs5m 5s
-
(Locked)
Challenge: Set up a file-based system with zero config2m 58s
-
(Locked)
Solution: Set up a file-based system with zero config10m 42s
-
-
-
-