What We'll Need Before We Begin
In this lesson, we'll talk about some prerequisites to AdonisJS and this series. These include installing NodeJS, VS Code, a database environment, and Redis.
- Author
- Tom Gobich
- Published
- Jan 24
- Duration
- 5m 45s
Developer, dog lover, and burrito eater. Currently teaching AdonisJS, a fully featured NodeJS framework, and running Adocasts where I post new lessons weekly. Professionally, I work with JavaScript, .Net C#, and SQL Server.
Adocasts
Burlington, KY
Transcript
What We'll Need Before We Begin
-
(upbeat music)
-
- Now, before we actually create our Donetsch JS project,
-
we have some prerequisites to get out of the way.
-
First and foremost, we're gonna need a text editor
-
to actually work within.
-
Throughout the series, I'm gonna be using a text editor
-
called Visual Studio Code.
-
You can download it from code.visualstudio.com
-
if you would like to use the same one that I am,
-
or if you're already comfortable
-
with a preexisting text editor,
-
feel free to continue onwards with that.
-
Now, we're also gonna need Node.js.
-
Node.js is the underlying environment
-
that AdonisJS runs within.
-
So that's what's actually going to execute our server
-
and get us up and running.
-
So for that, you can either head to nodejs.org
-
and download it from there.
-
It will walk you through a setup process
-
to get that installed within your system
-
if you go with this approach.
-
For AdonisJS version six,
-
you will want at least version 20 or higher.
-
So the LTS or long-term support version
-
will be perfectly acceptable for that.
-
If you wanna go for the latest features,
-
that one should work A-okay as well.
-
Now, an alternative approach to nodejs.org's download
-
is you can use a Node package manager.
-
For that, I like to use FastNodeManager.
-
It's pretty quick and easy to get set up
-
with your environment as it's cross-platform
-
and it also supports a number of different shells.
-
So I already have the LTS version 20 of Node.js installed,
-
but you can go ahead and give this script here a copy,
-
head into your terminal, paste it in.
-
If you're using Bash,
-
you'll be okay to just go ahead and hit Enter there.
-
Otherwise, you can backspace that
-
and either enter in zsh,
-
and it also supports phish shells as well.
-
Once you install that,
-
it will register it within your path.
-
So you may need to restart your terminal.
-
So just go ahead and close out and reopen it back up.
-
And now we should have the command fnm
-
readily available to us.
-
We could do --help to see the help commands for it.
-
Scroll up a little bit and you'll see the actual commands.
-
The one you're most likely interested in for right now
-
is install.
-
To install the long-term support version,
-
you would just need to run fnm install --lts,
-
and that will install the long-term support version,
-
after which you should be able to run
-
node --version and see that version printed out.
-
Cool.
-
So now we have Node.js installed,
-
if you followed along with either one of those two
-
approaches.
-
Again, make sure you have at least version 20 there.
-
Cool.
-
So next we're going to need a database environment.
-
This won't come into play until later on,
-
but it'll be good to get it out of the way
-
and install it now.
-
So AdonisJS supports a number of different
-
relational database environments.
-
So we could use something like MySQL,
-
Postgres, MS SQL or Microsoft SQL,
-
SQLite or MariaDB.
-
If you already have one of these installed on your system,
-
you'll be a-okay to move onwards.
-
Just note that whenever we get to that step,
-
you'll just want to install the appropriate driver.
-
Everything else that we'll do within the series
-
from there on should work exactly the same,
-
regardless of the database driver that you're working with.
-
If you don't have one installed,
-
I'll be using Postgres SQL.
-
You can go ahead and download it from here.
-
Again, that should just walk through you some steps.
-
And then once you're finally installed,
-
you should have an application called pgAdmin.
-
Now, the first time pgAdmin opens up on your system,
-
it's probably going to ask you to set a password.
-
You'll want to remember that password,
-
since it's just on your local system,
-
you can make it something relatively easy to remember.
-
For example, mine is just password.
-
So I'm going to go ahead and hit okay here.
-
On the left-hand side, we have a list of our servers.
-
We're just going to have the one server version
-
that we have installed.
-
I have Postgres SQL 14.
-
And then it's also going to list out our databases.
-
These are all the databases I have installed locally
-
on my system.
-
Don't worry too much about that.
-
You probably won't have any.
-
Just right-click on databases.
-
You can hit create database, give it a name.
-
For this series,
-
let's go ahead and call our database Adonis6.
-
Note the owner is Postgres.
-
So whenever we need to actually connect to this database,
-
we'll be able to use this as a username
-
and then whatever password we set as the password.
-
So you will want to remember the password.
-
And then if your owner is Postgres,
-
I'll help you remember that whenever we get to that time.
-
If you've set your owner to something different,
-
you'll want to remember that.
-
Okay, let's go ahead and hit save there.
-
And we have successfully created our database.
-
At this point, it will be empty,
-
but we can just leave it empty.
-
Cool, so let's go ahead and close out of pgAdmin.
-
Cool, so the last thing that we're going to want to install
-
on our system is called Redis.
-
Redis is a caching database.
-
It's going to allow us to really quickly
-
store information into the database,
-
get information out of the database,
-
and determine whether or not we have any information
-
in that database.
-
Again, it's just for caching, not for long-term storage,
-
but for short-term storage to help speed up operations
-
on our system and store temporary information.
-
So let's go ahead and dive in
-
and get started with that one.
-
So this one's going to vary a little bit
-
depending on your system.
-
So head on over to redis.io/docs/install/installredis.
-
And from here, you'll be able to select
-
based on your system.
-
If you're using Linux, click here.
-
If you're using macOS, click there.
-
And lastly, Windows, there.
-
I'm using macOS, so I'm going to click on macOS here.
-
Cool, so for macOS, it's going to assume
-
that you have Homebrew installed, which I do.
-
But to verify that, you can run brew-version.
-
So we'll jump back into our terminal here.
-
I'll go ahead and clear this out
-
and type in brew-version.
-
Cool, and I see Homebrew 4.2.2 printed out,
-
so I do indeed have it installed.
-
And then lastly, we can go ahead and install Redis
-
by doing brew install redis.
-
So brew install redis.
-
I already have this installed,
-
so I'm going to skip actually executing this.
-
But if you don't have it installed
-
and you happen to have macOS,
-
go ahead and give that a run
-
and it should install it for you.
-
Then we need to just actually start and stop the service.
-
So redis-server, we'll start it in the foreground,
-
but it would be great to have it running in the background
-
so that we don't need to dedicate a terminal shell
-
to just running Redis.
-
So we can start in the background
-
by running brew services start redis.
-
So we can do brew services start redis,
-
and that'll get it up and running.
-
I already have it running,
-
but we can go ahead and execute it
-
and it should just show that it is already running.
-
There we go, cool.
-
So again, we don't need to do anything with Redis
-
at this point in time.
-
That'll come later on
-
whenever we get to talking about caching
-
and all that fun stuff within this series.
-
So we have our environment set up.
-
So now we're actually ready to go ahead
-
and create our project.
-
So let's do that in the next lesson.
-
Introduction
-
Fundamentals
-
2.0Routes and How To Create Them5m 23s
-
2.1Rendering a View for a Route6m 29s
-
2.2Linking Between Routes7m 51s
-
2.3Loading A Movie Using Route Parameters9m 17s
-
2.4Validating Route Parameters6m 6s
-
2.5Vite and Our Assets6m 38s
-
2.6Setting Up Tailwind CSS9m 5s
-
2.7Reading and Supporting Markdown Content4m 32s
-
2.8Listing Movies from their Markdown Files8m 51s
-
2.9Extracting Reusable Code with Services7m 4s
-
2.10Cleaning Up Routes with Controllers4m 52s
-
2.11Defining A Structure for our Movie using Models9m 38s
-
2.12Singleton Services and the Idea of Caching6m 11s
-
2.13Environment Variables and their Validation4m 16s
-
2.14Improved Caching with Redis10m 44s
-
2.15Deleting Items and Flushing our Redis Cache6m 46s
-
2.16Quick Start Apps with Custom Starter Kits6m 28s
-
2.17Easy Imports with NodeJS Subpath Imports8m 40s
-
-
Building Views with EdgeJS
-
3.0EdgeJS Templating Basics8m 49s
-
3.1HTML Attribute and Class Utilities6m 9s
-
3.2Making A Reusable Movie Card Component10m 24s
-
3.3Component Tags, State, and Props4m 53s
-
3.4Use Slots To Make A Button Component6m 56s
-
3.5Extracting A Layout Component5m 13s
-
3.6State vs Share Data Flow2m 59s
-
3.7Share vs Global Data Flow6m 7s
-
3.8Form Basics and CSRF Protection6m 13s
-
3.9HTTP Method Spoofing HTML Forms3m 3s
-
3.10Easy SVG Icons with Edge Iconify7m 57s
-
-
Database and Lucid ORM Basics
-
4.0Configuring Lucid and our Database Connection4m 3s
-
4.1Understanding our Database Schema9m 35s
-
4.2Introducing and Defining Database Migrations18m 35s
-
4.3The Flow of Migrations8m 28s
-
4.4Introducing Lucid Models5m 43s
-
4.5Defining Our Models6m 49s
-
4.6The Basics of CRUD11m 56s
-
4.7Defining Required Data with Seeders11m 11s
-
4.8Stubbing Fake Data with Model Factories13m 48s
-
4.9Querying Our Movies with the Query Builder15m 30s
-
4.10Unmapped and Computed Model Properties3m 24s
-
4.11Altering Tables with Migrations7m 6s
-
4.12Adding A Profile Model, Migration, Factory, and Controller2m 57s
-
4.13SQL Parameters and Injection Protection9m 19s
-
4.14Reusable Query Statements with Model Query Scopes8m 11s
-
4.15Tapping into Model Factory States9m 15s
-
4.16Querying Recently Released and Coming Soon Movies4m 59s
-
4.17Generating A Unique Movie Slug With Model Hooks7m 59s
-
-
Lucid ORM Relationships
-
5.0Defining One to One Relationships Within Lucid Models5m 49s
-
5.1Model Factory Relationships2m 54s
-
5.2Querying Relationships and Eager Vs Lazy Loading5m 17s
-
5.3Cascading and Deleting Model Relationships5m 16s
-
5.4Defining One to Many Relationships with Lucid Models6m 56s
-
5.5Seeding Movies with One to Many Model Factory Relationships5m 24s
-
5.6Listing A Director's Movies with Relationship Existence Queries8m 41s
-
5.7Listing and Counting a Writer's Movies8m 41s
-
5.8Using Eager and Lazy Loading to Load A Movie's Writer and Director5m 18s
-
5.9Defining Many-To-Many Relationships and Pivot Columns9m 48s
-
5.10Many-To-Many Model Factory Relationships4m 50s
-
5.11A Deep Dive Into Relationship CRUD with Models18m 5s
-
5.12How To Create Factory Relationships from a Pool of Data13m 55s
-
5.13How To Query, Sort, and Filter by Pivot Table Data9m 47s
-
-
Working With Forms
-
6.0Accepting Form Data12m 15s
-
6.1Validating Form Data with VineJS9m 29s
-
6.2Displaying Validation Errors and Validating from our Request7m 16s
-
6.3Reusing Old Form Values After A Validation Error2m 3s
-
6.4Creating An EdgeJS Form Input Component5m 28s
-
6.5Creating A Login Form and Validator5m 1s
-
6.6How To Create A Custom VineJS Validation Rule9m 7s
-
-
Authentication & Middleware
-
7.0The Flow of Middleware7m 49s
-
7.1Authenticating A Newly Registered User4m 14s
-
7.2Checking For and Populating an Authenticated User2m 10s
-
7.3Logging Out An Authenticated User2m 24s
-
7.4Logging In An Existing User6m 54s
-
7.5Remembering A User's Authenticated Session6m 55s
-
7.6Protecting Routes with Auth, Guest, and Admin Middleware5m 36s
-
-
Filtering and Paginating Queries
-
8.0Creating A Movie List Page3m 43s
-
8.1Filtering A Query By Pattern Likeness7m 9s
-
8.2Filtering Our List by Movie Status5m 47s
-
8.3How To Apply A Dynamic Sort Filter To Your Query7m 12s
-
8.4Joining SQL Tables To Order By A Related Column4m 49s
-
Validating Query String Filter Values7m 23s
-
How To Paginate Filtered Query Results9m 15s
-
Pagination First, Last, Next, and Previous Buttons4m 2s
-
-
User Watchlist
-
An Alternative Approach to Many-To-Many Relationships4m 56s
-
Toggling A Movie in an Authenticated User's Watchlist9m 56s
-
Listing and Filtering User Watchlist Items7m 34s
-
Allowing Users To Toggle A Movie As Watched4m 44s
-
Filtering By User's Watched Status6m 7s
-
Defining A Composite Unique Constraint4m 46s
-
Join The Discussion! (4 Comments)
Please sign in or sign up for free to join in on the dicussion.
tmuco
Hello Tom,
Are you planning to cover automated testing in this series?
And as always, thank you for the hard work you put into this great content.
Please sign in or sign up for free to reply
tomgobich
Hi tmuco!
Not specifically within this series, but we are planning to use the completed code from this series within another series to cover testing with Japa!
You can find what's on our radar at the page below, though series planned isn't in any particular order.
https://adocasts.com/schedule
Please sign in or sign up for free to reply
rnam-dev
Many thanks for the effort you made to provide us with a very detailed training series on Adonis js, many thanks again
Please sign in or sign up for free to reply
tomgobich
Thank you for watching, rnam!!
Please sign in or sign up for free to reply