So in order for this meals grid component
to be useful and in order to see something
on the screen here, we need meals.
And for that I wanna set up a basic database
that will store some dummy meals
and that will later also store meals shared by users.
And for that, I'll stop my development server here
with Ctrl + C,
and I'll install a new dependency with NPM install.
And that dependency is the better-sql light three package.
And this is a package that will allow us to work
with a SQL light database.
And I'll use a SQL light database here
because it's an amazing SQL database
that can be used locally without setting up any extra
database server or any other complex setup needed.
Now, in order to create a database
and populate it with some dummy data,
I prepared an initdb.js file,
which you find attached to this lecture,
and you should store that file simply
in your root project directory.
This file uses the package we just installed
to create a new database file if it doesn't exist yet
otherwise it'll use the existing one.
And it then contains a bunch of dummy meals data
so that we have some meals to get started,
which are then written into that database
that happens down here.
First, a new table is created if it doesn't exist yet,
and the columns of that table are configured
so that every meal has an ID,
which is created automatically.
Every meal has a unique slug.
Every meal has a title, an image,
though that will be the path to an image,
not the file itself.
And then also a summary instructions,
the name of the creator and the email of the creator.
And that's all data I have here in that dummy data.
And that's all data will later collect
from the website visitors.
And then with that table created,
I have this init data function, which is then executed
to write some data into that database.
I'm simply writing all those dummy meals into the database.
And this prepare function, which you see here,
is provided by that better SQL light free package.
So that's how I'm preparing the database.
And with that done, once you run this initdb.js file,
you should have some meals available.
So here in my root project folder,
I'll execute this initdb.js file with node
and it should work.
And you should have such a meals DB file thereafter.
That is that SQL Light database that we'll use now.
Now with that done, we can go back to our meals page
and start loading meals from that database.
And the question now, of course, is how we do that?