Adding an API to an AdonisJS Web App

Beginner
28 Lessons
3h 16m

In this series, we'll add a API, using Opaque Access Tokens for authentication, to a preexisting web application. We'll implement dual-guard authentication, add a token management panel, and authenticate our API directly with an organization model!

Module 1 › Introduction (4 lessons)

Video preview
Goal of this Series
Lesson 1.0
・
Apr 18

Goal of this Series

We'll cover the scope of this series and show some of the functionalities we'll be building throughout, which include an access token management panel, opaque access token authentication using an organization model, and building an API.

Video preview
Getting Up and Running
Lesson 1.1
・
Apr 18

Getting the Web Project Up & Running

We'll get our web project cloned down. Then, we'll get it configured by first creating our database and running our migrations and seeder. Lastly, we'll get a test SMTP email inbox set up through MailTrap.

Video preview
Getting Familiar with our Web Project
Lesson 1.2
・
Apr 18

Getting Familiar with our Web Project

In this lesson, we'll quickly walk through the web application we've cloned down to get familiar with the data at play, how it's presented to the user, and the features at hand.

Video preview
Lesson 1.3
・
Apr 18

Overview of our Database Schema

In this lesson, we'll take a high level look at our database's schema so that we have an understanding at the entities and models at play and how they relate to one another within our application.

Module 2 › API Authentication (9 lessons)

Video preview
Configuring Api Authentication
Lesson 2.0
・
Apr 21

Configuring Access Token Auth on top of Session Auth

In this lesson, we'll get opaque access tokens configured within our AdonisJS application on top of the already configured session/web authentication. This will include configuring the guard and setting up the db access token provider.

Video preview
Separation of Concerns
Lesson 2.1
・
Apr 21

Separation of API & Web Auth Guard Concerns

In this lesson, we'll restrict our routes to their applicable authentication guard. Ensuring our web routes can properly authorize using their role-based authorization and our API can properly authorize using our access token abilities.

Video preview
Access Token Abilities
Lesson 2.2
・
Apr 21

Defining Access Token Abilities & DTO

In this lesson, we'll finish up our preparation work by creating a data transfer object (DTO) for our access tokens. Then, we'll define what our token abilities will be within our application's API.

Video preview
Creating Access Tokens Part 1: AdonisJS
Lesson 2.3
・
Apr 25

Creating Access Tokens Part 1: AdonisJS

In this lesson, we'll add a route to the settings portion of our application allowing the user to create an opaque access token (OAT), with the desired permissions, for the active organization.

Video preview
Creating Access Tokens Part 2: VueJS
Lesson 2.4
・
Apr 25

Creating Access Tokens Part 2: Inertia/Vue

In this lesson, we'll rig up the create access token route we created in the last lesson to a form within our Vue application. We'll also stub the overall manage access tokens card for the organization itself.

Video preview
OAT vs JWT
Lesson 2.5
・
May 02

Opaque Access Tokens (OAT) vs JSON Web Tokens (JWT)

In this lesson, we'll take a step back to understand the differences between the tokens we're using, which are Opaque Access Tokens (OAT), and JSON Web Tokens (JWT). We'll discuss security, scalability, and what makes up each token.

Video preview
Adocasts Plus Exclusive
Exclusive
Listing Access Tokens
Lesson 2.6
・
May 02

Listing an Organization's Access Tokens

In this lesson, we'll query all of our organization's access tokens and filter out any tokens that are expired. Then, we'll list the organization's tokens showing it's name, abilities, when it was created, and when it was last used.

Video preview
Adocasts Plus Exclusive
Exclusive
Copying the Access Token
Lesson 2.7
・
May 22

Displaying & Copying A Newly Created Access Token

In this lesson, we'll add a secondary step to our access token creation flow that will display the newly created access token to the user one time, allow them to copy the token, then drop the token completely from memory.

Video preview
Adocasts Plus Exclusive
Exclusive
Deleting Access Tokens
Lesson 2.8
・
May 22

Deleting/Revoking Access Tokens

In this lesson, we'll add the ability for our users to revoke an access token by deleting it out of our database.

Module 3 › Getting Started with APIs (4 lessons)

Video preview
Adocasts Plus Exclusive
Exclusive
Goal of our API
Lesson 3.0
・
May 30

The Goal of our REST API

In this lesson, we'll briefly give an overview of REST and how we'll be taking a practical approach to it when building our API.

Video preview
Adocasts Plus Exclusive
Exclusive
Our first API endpoint
Lesson 3.1
・
May 30

Our First API Endpoint to Get Our Organization's Details

In this lesson, we'll add the first endpoint to our API. With this endpoint we'll return back the Organization's details for the provided Access Token with the request.

Video preview
Adocasts Plus Exclusive
Exclusive
Setting up our REST Client
Lesson 3.2
・
May 30

Setting Up Our REST Client

In this lesson, we'll take some time to get set up and get comfortable with a REST Client application. This will allow us to store our API endpoints within collections to simplify testing them as we build them out. In this series, I'll be using Hoppscotch

Video preview
Adocasts Plus Exclusive
Exclusive
Simple API Versioning
Lesson 3.3
・
May 30

Simple API Versioning

In this lesson, we'll implement a simple versioning mechanism for our API. Versioning allows us to safely make breaking changes without breaking our user's implementations of our API.

Module 4 › Organization Resources (8 lessons)

Video preview
Adocasts Plus Exclusive
Exclusive
Listing Difficulties
Lesson 4.0
・
Jun 12

Listing Organization Difficulties

In this lesson, we'll begin work on our first CRUD-based API resource by adding the ability to query a list of all our organization's difficulties.

Video preview
Adocasts Plus Exclusive
Exclusive
Creating Difficulties
Lesson 4.1
・
Jun 12

Creating Organization Difficulties

Next, we'll add a POST route and handler so that we can create difficulties from our API

Video preview
Adocasts Plus Exclusive
Exclusive
Getting A Difficulty
Lesson 4.2
・
Jun 12

Getting A Specific Difficulty

In this lesson, we'll add a GET API route enabling us to get the details of a specific difficulty by providing the difficulties id via route parameter.

Video preview
Adocasts Plus Exclusive
Exclusive
Updating A Difficulty
Lesson 4.3
・
Jun 12

Updating A Difficulty

In this lesson, we'll add a PUT API route to handle updating our difficulties! This route will also accept in a specific difficulty id via route parameter to specify which difficulty should be updated.

Video preview
Adocasts Plus Exclusive
Exclusive
Deleting A Difficulty
Lesson 4.4
・
Jun 12

Deleting A Difficulty

The last CRUD method we need to add is the ability to delete our a difficulty by adding a DELETE API route, we'll take care of that in this lesson.

Video preview
Adocasts Plus Exclusive
Exclusive
Access Level CRUD
Lesson 4.5
・
Jun 20

Access Level API CRUD

In this lesson, we'll walk through adding API endpoints for the full CRUD (create, read, update, and delete) flow for our organization's access levels.

Video preview
Adocasts Plus Exclusive
Exclusive
Status CRUD
Lesson 4.6
・
Jun 20

Status API CRUD

In this lesson, we'll duplicate everything we did one more time for our organization's statuses.

Video preview
Adocasts Plus Exclusive
Exclusive
API Authorization
Lesson 4.7
・
Jun 20

API Authorization Checks

In this lesson, we'll implement our API Authorization checks across all the API controller methods we've implemented thus far. We'll then create a specific access token for each operation (read, create, update, and delete) to ensure everything is working.

Module 5 › Courses (3 lessons)

Video preview
Adocasts Plus Exclusive
Exclusive
Listing Courses
Lesson 5.0
・
Jun 27

Listing Courses

Our goal in this step is to add an endpoint that lists our courses. We'll then build upon this endpoint further with the ultimate goal of getting a list of paginated courses.

Video preview
Adocasts Plus Exclusive
Exclusive
Creating, Updating, and Deleting Courses
Lesson 5.1
・
Jun 27

Creating, Updating, and Deleting Courses

In this lesson, we'll add endpoints to allow creating, updating, and deleting courses from our API. We'll then use this to stub a number of test courses to give us wiggle room to play with our pagination.

Video preview
Adocasts Plus Exclusive
Exclusive
Paginating Courses
Lesson 5.2
・
Jun 27

Paginating our Course List

In this lesson, we'll transform our courses list endpoint into a pagination endpoint. We'll check and validate our query string for a page and per page parameter that we'll then use to fetch pages of our courses.

excited robot

More in the works!

Add to your watchlist to get notified when new lessons are added

Sign in or sign up to add to your watchlist