v2 launch promo! Get a one-off 50% discount on PRO yearly using V2LAUNCHPROMO. Get started

Build A RESTful API With AdonisJS

Build A RESTful API With AdonisJS

12 lessons
Start course

In this course, I will be showing you how to build a RESTful API with AdonisJS 5. If you are new to building APIs with AdonisJS, then this course is for you. Together, we will build an API for a forum. We are going to look at things like authentication, pagination, filtering and sorting. Along the line, we will cover some best practices such as structuring endpoints, using correct HTTP methods, using correct HTTP status codes as well as response formats.

Getting Started

7m 35s

Welcome to the build a RESTful API with AdonisJS course, where we will build an API for a forum. In this lesson, we introduce the course and go over what we'll be building in the course.

We start off the course by creating a new AdonisJS 5 API server.

In the last lesson, we created our API server. Now, let's start configuring the sever by setting up a database.

Forum threads will be categorized into categories, but to keep things simple and pretty straightforward we won't be adding implementation for creating categories, instead we will seed the database with some categories so we can have something to work with. In this lesson, we cover exactly how to go about that.


Since REST APIs are stateless, we set up the API server to make use for API tokens for authentication.

In this lesson, we look at how to allow users to register on our API, and generate API token upon registering.

In the last lesson we allow users to register for an account and upon registering we generated an API token for the user. In this lesson, we are going to add the ability for returning users to login.


In this lesson, we move on to at the core of the forum API by looking how to create threads. Also, we cover associating users and categories to threads.

So we have created a thread, how do we retrieve it subsequently? Well, we are going to look at how to do just that in this lesson.

In the last lesson, we saw how to fetch a single thread. Now, let's take a look at how to fetch a list of threads.

Now, let's move on to updating threads. When it comes to updating records, there are typically 2 HTTP methods that are mostly used to handle that, which are PUT and PATCH. They both tend to do the same thing but in slightly different ways.

To complete the CRUD flow, let's implement deleting threads.

*Course still in development. Do check back often for updates.

Chimezie Enyinnaya

Hi, I'm Chimezie Enyinnaya, your teacher.

I’m a self-taught software developer based in Lagos, Nigeria, with over 8 years of experience. In the last couple of years, I've been doing more teaching because I enjoy sharing my knowledge so that others can benefit from it. Come along as I teach you all I know about AdonisJS, Node.js, and JavaScript at large!