From the course: Learning Next.js

Unlock the full course today

Join today to access over 22,800 courses taught by industry experts or purchase this course individually.

Building a file-based routing system

Building a file-based routing system

From the course: Learning Next.js

Start my 1-month free trial

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…

Contents