1
00:00:00,000 --> 00:00:01,000
Now as mentioned,

2
00:00:01,000 --> 00:00:04,000
we're going to build up on the project we built

3
00:00:04,000 --> 00:00:06,000
in the previous section.

4
00:00:06,000 --> 00:00:08,000
So that's what I opened here,

5
00:00:08,000 --> 00:00:11,000
but there is an important difference

6
00:00:11,000 --> 00:00:14,000
compared to that project.

7
00:00:14,000 --> 00:00:18,000
I added a new backend folder to my project

8
00:00:18,000 --> 00:00:22,000
and you find that folder attached as a SIP file

9
00:00:22,000 --> 00:00:25,000
and you should simply add it to your project as well.

10
00:00:26,000 --> 00:00:31,000
This folder, in the end contains some dummy API code,

11
00:00:31,000 --> 00:00:33,000
and after downloading the SIP file,

12
00:00:33,000 --> 00:00:37,000
you should navigate into that folder once you added it

13
00:00:37,000 --> 00:00:40,000
and run npm install to install all the dependencies

14
00:00:40,000 --> 00:00:42,000
of that extra API.

15
00:00:43,000 --> 00:00:46,000
Because this backend mini project here

16
00:00:46,000 --> 00:00:50,000
is basically a separate project,

17
00:00:50,000 --> 00:00:53,000
it's integrated into this overall NextJS project,

18
00:00:53,000 --> 00:00:56,000
but it's a separate backend server

19
00:00:56,000 --> 00:01:00,000
with which I wanna simulate that we're not just building

20
00:01:00,000 --> 00:01:02,000
our NextJS application here,

21
00:01:02,000 --> 00:01:07,000
but that we also might have some extra rest API

22
00:01:07,000 --> 00:01:12,000
that's providing some data for this NextJS application here

23
00:01:12,000 --> 00:01:16,000
and potentially also for our clients.

24
00:01:16,000 --> 00:01:18,000
Now, if we take a look at this app.js file,

25
00:01:18,000 --> 00:01:20,000
which is the main code file,

26
00:01:20,000 --> 00:01:24,000
the only code file of this separate backend project,

27
00:01:24,000 --> 00:01:27,000
we see that in there we still got the DUMMY_NEWS there,

28
00:01:27,000 --> 00:01:31,000
but only so that we can use that dummy data to

29
00:01:31,000 --> 00:01:35,000
pre-populate a database as SQLite database,

30
00:01:35,000 --> 00:01:39,000
which is this file here, this data.db file.

31
00:01:39,000 --> 00:01:43,000
Because the idea in this section now is to simulate that

32
00:01:43,000 --> 00:01:47,000
we do use a database to store data.

33
00:01:47,000 --> 00:01:50,000
Later in the course, you will also learn how to change

34
00:01:50,000 --> 00:01:51,000
that data in the database.

35
00:01:51,000 --> 00:01:53,000
For the moment, in this section,

36
00:01:53,000 --> 00:01:55,000
it's all about fetching data

37
00:01:55,000 --> 00:01:57,000
and that's why I'm initializing

38
00:01:57,000 --> 00:02:01,000
and pre-populating that database with those DUMMY_NEWS.

39
00:02:01,000 --> 00:02:03,000
But in the end, the simulation now is

40
00:02:03,000 --> 00:02:05,000
that we don't have the DUMMY_NEWS in our code,

41
00:02:05,000 --> 00:02:07,000
even though we technically do,

42
00:02:07,000 --> 00:02:09,000
but instead in a database.

43
00:02:09,000 --> 00:02:10,000
I guess you get my point.

44
00:02:10,000 --> 00:02:13,000
That's what we're trying to simulate in this section.

45
00:02:14,000 --> 00:02:17,000
Well, and then the main code of this backend API

46
00:02:17,000 --> 00:02:19,000
is one single route,

47
00:02:19,000 --> 00:02:23,000
get route to /news on that backend server,

48
00:02:23,000 --> 00:02:27,000
which in the end fetches all the news and returns them.

49
00:02:27,000 --> 00:02:30,000
That's what we do in this backend API.

50
00:02:30,000 --> 00:02:34,000
And we could now use this backend API in our NextJS

51
00:02:34,000 --> 00:02:37,000
application in order to fetch that data

52
00:02:37,000 --> 00:02:40,000
or from any other client.

53
00:02:40,000 --> 00:02:42,000
And that's indeed what we'll get started

54
00:02:42,000 --> 00:02:44,000
with in the next lectures.

