1
00:00:00,260 --> 00:00:00,680
All right, guys.

2
00:00:00,680 --> 00:00:06,800
So before we get started on our back end, I just want to kind of go over just an overall picture of

3
00:00:06,800 --> 00:00:10,670
how this is going to work, this full stack application workflow.

4
00:00:10,670 --> 00:00:14,990
So we've already started on our client, our front end, right?

5
00:00:14,990 --> 00:00:16,219
This part right here.

6
00:00:16,219 --> 00:00:17,900
So we have a folder called Front End.

7
00:00:17,900 --> 00:00:19,490
That's where React Lives.

8
00:00:19,490 --> 00:00:22,880
That's where we'll be using Redux for our application state.

9
00:00:22,880 --> 00:00:25,880
Anything that has to do with the user interface.

10
00:00:26,090 --> 00:00:26,420
All right.

11
00:00:26,450 --> 00:00:32,600
Now in the next video, we're going to start to create our back end, which is going to be our NodeJS

12
00:00:32,630 --> 00:00:34,040
and Express server.

13
00:00:34,040 --> 00:00:39,740
So that's where we're going to have routes that will do certain actions.

14
00:00:39,740 --> 00:00:46,700
So for instance, we'll have a route at slash API slash products and we'll be able to make different

15
00:00:46,730 --> 00:00:47,900
types of requests.

16
00:00:47,900 --> 00:00:53,990
So for instance, if we want to fetch our products, we can make a get request to API slash products.

17
00:00:53,990 --> 00:00:59,510
If we want to create a new product, we'd make a post request from our client and we'd have some data

18
00:00:59,510 --> 00:01:04,590
in the body, the product data, and we'd make a post request to API products.

19
00:01:04,590 --> 00:01:11,310
If we want to update or delete, we would make a put or a delete request and that would be to API products

20
00:01:11,310 --> 00:01:15,630
slash and then whatever ID of the product that we want to update.

21
00:01:15,660 --> 00:01:15,950
Okay.

22
00:01:15,960 --> 00:01:17,730
So it's going to work like that for products.

23
00:01:17,730 --> 00:01:24,900
It's going to work like that for orders for users and we'll even have a route to create product reviews.

24
00:01:24,930 --> 00:01:27,150
And then we're also going to have authentication.

25
00:01:27,150 --> 00:01:33,180
So with authentication, we're going to use Json web tokens, which I'll explain when we get to it.

26
00:01:33,180 --> 00:01:39,060
But instead of keeping that token on the client in local storage, we're going to keep it in what we

27
00:01:39,060 --> 00:01:44,670
call an Http only cookie on the server so that it can't be read by the client.

28
00:01:44,670 --> 00:01:47,220
It's just a more secure way to store it.

29
00:01:47,220 --> 00:01:50,760
In the first version of this course, we did store it in local storage.

30
00:01:50,760 --> 00:01:56,220
A lot of courses that you watch, a lot of tutorials online, they will store it in local storage and

31
00:01:56,220 --> 00:02:01,370
it can be fine in some cases, but it is safer to keep it on the server.

32
00:02:01,370 --> 00:02:01,700
All right.

33
00:02:01,700 --> 00:02:06,590
So that's what we'll be doing as far as authentication and we'll have some auth middleware that will

34
00:02:06,590 --> 00:02:14,150
then read that token from the Http only cookie and validate the user and then proceed to let the user

35
00:02:14,180 --> 00:02:16,670
do whatever it is they're allowed to do.

36
00:02:16,760 --> 00:02:17,180
All right.

37
00:02:17,210 --> 00:02:25,280
Now regular users are going to be able to obviously purchase, you know, make purchases, create orders

38
00:02:25,280 --> 00:02:26,180
and so on.

39
00:02:26,180 --> 00:02:33,710
And we're also going to have another role, I guess you could call it a role of admin, where admin

40
00:02:33,710 --> 00:02:36,020
users can pretty much do anything.

41
00:02:36,020 --> 00:02:45,320
They can create products, they can update delete products, they can set orders to to delivered, they

42
00:02:45,320 --> 00:02:50,510
can change statuses, they can delete users, all kinds of stuff.

43
00:02:50,510 --> 00:02:50,840
All right.

44
00:02:50,840 --> 00:02:57,440
So there's basically going to be two roles, just regular users that are shoppers and then admin users.

45
00:02:57,590 --> 00:02:57,980
Okay.

46
00:02:57,980 --> 00:03:02,790
Now, as far as data, we're going to be storing our data in MongoDB.

47
00:03:03,090 --> 00:03:03,210
Okay?

48
00:03:03,300 --> 00:03:10,980
We're going to be using MongoDB Atlas, which is the cloud version of MongoDB and to connect to MongoDB

49
00:03:11,220 --> 00:03:16,410
as well as make our queries, we're going to be using Mongoose, which is an object data mapper.

50
00:03:16,410 --> 00:03:24,630
So it gives us an easy way to fetch products and update products and orders and all that good stuff.

51
00:03:24,780 --> 00:03:25,140
All right.

52
00:03:25,140 --> 00:03:29,640
So that's kind of just a very high level overview of what we'll be doing.

53
00:03:29,640 --> 00:03:36,060
I just wanted to kind of get the get this picture in your head moving forward so you know what's going

54
00:03:36,060 --> 00:03:36,660
on.

55
00:03:36,690 --> 00:03:37,020
All right.

56
00:03:37,020 --> 00:03:40,980
So in the next video, we're going to start on our NodeJS and Express server.

