Routing Introduction — Let’s Learn Adonis 5, Lesson 2.0

Tom Gobich |
7 min readNov 19, 2021

View all lessons in the Let’s Learn Adonis 5 series here.

Routes are how we can go about defining URLs that will be accessible via our application. So, in order to add a page to our application, we’d need to first define a route for that page. This route definition would register a URL for that page and tell our server what to do when that URL is requested.

The Default Route

By default, Adonis starts our route definitions within the start directory within a file called routes.ts. Out-of-the-box we're provided a single route definition for the welcome page we saw when we booted our application to ensure everything installed okay.

// start/routes.tsimport Route from '@ioc:Adonis/Core/Route'Route.get('/', async ({ view }) => {
return view.render('welcome')

Note, in the last lesson we changed this slightly to show how you can expand your HttpContext. I’ve undone those changes here.

So, What’s Happening Here?

First, we’re importing the Route module from @ioc:Adonis/Core/Route, which we'll use to define our routes. Then…



Tom Gobich |

Learn AdonisJS, NodeJS, JavaScript and more through in-depth lessons, screencasts, and livestreams at