AdonisJS 5 From Scratch

AdonisJS 5 From Scratch

1hr 51mins
31 lessons
Beginner
Start course

AdonisJS 5 (preview) was released recently and as we all have expected, it comes with a lot of improvement as well as new features. Above, all AdonisJS 5 has been completely rewritten in TypeScript, which means we get to make use of all the great TypeScript features such as type safety and IntelliSense support. In this course, we'll learn AdonisJS 5 completely from scratch.

This is a project-based course, where you get to learn by building. We'll cover each aspect of the framework while we gradually build a tasks application.

View the source code for the course project on GitHub.

Getting Started

1m 44s

We start with a brief introduction to AdonisJS and the format of the course.

In this lesson, we set up our computer by installing the necessary requirements for AdonisJS 5 such as Node.js >= 12 and NPM >= 6.

In this lesson, we see how to create our first AdonisJS 5 application using create-adonis-ts-app.

Ace is a command line tool for executing AdonisJS commands. In this lesson, we take a look at how to make use of it to run commands.

Since TypeScript cannot be executed directly by Node.js, we need to compile it to JavaScript, which Node.js can then execute. Let’s take a moment to understand what happens when we run serve command.

In this lesson, we go over the directory structure of an AdonisJS 5 application.

Routing

4m 47s

Routes serve as entry points to an AdonisJS application. In this lesson, we cover how to create routes.

3m 8s

We have seen how to create static routes, what if we want to create dynamic routes? In this lesson, we cover how to do just that.

While it’s totally fine to use inline handler, but this can make routes.ts to become messy. Hence, it is recommended to move route handling implementation out of the routes file to a dedicated file called controller.

5m 15s

Naming routes can save time or help prevent broken links if we ever change the URLs later on. In the lesson, we cover that named routes are and how to use them.

Views

Edge is AdonisJS templating engine, and in this lesson, we cover the basics of the templating engine.

Ideally, we will need to pass data to our views, be it from the database, the HTTP context, or even computational data. Let’s see how we can do that.

Typically, we would want to have a kind master HTML layout, which other pages can extend instead of having to repeat the same HTML boilerplate across al