

Controllers
Controllers are a great way to cleanly direct the business logic needed to handle requests for a route within your application.
From The Feed
-
Is there any point in putting try/catch statements in each method of a controller?
... Read moreI'm using Adonis JS as the API for my application. For each method in my controllers, I add try/catch statements to handle errors and return a response to my front-end in case one occurs. async createDiscussion({ request, auth, respo
Lessons.


Creating A Login Form and Validator
In this lesson, we'll apply what we've learned to create a login page as well as a validator for our login form.


Accepting Form Data
In this lesson, we'll take a look at how we can create a register form and accept data from that form within our route handler.


Adding A Profile Model, Migration, Factory, and Controller
Uh oh, a new requirement has come in and now we also need to account for user profiles! In this lesson, we'll learn how we can easily create a new model, migration, factory, and controller for an entity in one fell swoop!


Cleaning Up Routes with Controllers
In this lesson, we'll learn what controllers are and how they can be used to drastically simplify our route definitions by allowing us to move our route handlers off the route definition and into the controller.

Route & Controller Resources
In this lesson, we'll learn what a resource is and how we can quickly and easily define a route resource and handle each resourceful route with a resource controller.

Handling Routes with Controllers
In this lesson, we'll learn about Controllers and how we can keep our route definitions clean and easy to scan by extracting our route handlers into these Controllers.

Let's Learn Adonis 5: Controllers, Services, Resources, and Namespacing
In this lesson, we'll be hammering down several Adonis topics in one swoop. We'll be covering Controllers, which in turn allow us to utilize Services, Resources, and Namespacing.
Showing 21 to 27 of 27 results