Routing

Learn about routes and how they are created.

Introduction

The start/routes.js file defines the URL patterns that we allow our users to access as entry points to our web application. Every time a user requests a certain URL, Adonis finds the URL pattern inside start/routes.js. If the pattern matches, Adonis processes the logic defined inside that route. We can bind routes with controllers as logic handlers. We can also attach routes to middleware and validators. We will go over controllers, middleware, and validators later.

Creating routes

Here’s an example defining some routes:

Get hands-on with 1200+ tech skills courses.