1
00:00:00,210 --> 00:00:00,690
Wonderful.

2
00:00:01,030 --> 00:00:04,710
Once we can see that, we can access all the routes correctly.

3
00:00:05,640 --> 00:00:07,830
And I'll start working on just the controller.

4
00:00:08,850 --> 00:00:15,240
There are multiple steps, but the first video I just want you to create a user.

5
00:00:15,680 --> 00:00:23,250
Remember, we need to use the model and also try to import the status codes and custom error like we

6
00:00:23,250 --> 00:00:23,850
didn't before.

7
00:00:24,390 --> 00:00:28,290
And only while testing, send back the entire user.

8
00:00:28,920 --> 00:00:36,660
Now I'm fully aware that at this point, our password setup is a total mess, as well as we're not handling

9
00:00:36,660 --> 00:00:38,730
the unique email situation.

10
00:00:39,090 --> 00:00:43,710
But don't worry about it right now for the time being, just do those two things.

11
00:00:44,040 --> 00:00:45,500
So create user.

12
00:00:46,320 --> 00:00:52,320
Figure out where we can access that data and then just send back the entire user group.

13
00:00:52,830 --> 00:00:53,910
Let's start working on that.

14
00:00:54,330 --> 00:00:56,760
So I'm going to navigate back to the author controller.

15
00:00:57,060 --> 00:00:58,800
And first, I want to import everything.

16
00:00:59,220 --> 00:01:01,850
I want to get my user from the models.

17
00:01:01,860 --> 00:01:07,800
I want to get the status codes because we'll have to use them as well as the customer, because we might

18
00:01:07,800 --> 00:01:09,000
run into that as well.

19
00:01:09,480 --> 00:01:12,360
So let's say here comes the user is equal to you require.

20
00:01:13,340 --> 00:01:14,720
We're looking for two models.

21
00:01:15,440 --> 00:01:22,190
So let's go to levels up your models and then we have the user model, then we want to set up these

22
00:01:22,190 --> 00:01:24,890
status codes that is coming from our package.

23
00:01:25,370 --> 00:01:34,920
So consent and status status codes is coming from HTP one or acquire, and then the package name is

24
00:01:34,950 --> 00:01:36,110
Bishop Steps codes.

25
00:01:36,110 --> 00:01:38,330
And we also want to get the custom error.

26
00:01:38,390 --> 00:01:39,110
So let's go.

27
00:01:40,070 --> 00:01:48,440
And this case, I'm going to do differently where I believe in a previous project, actually the structured

28
00:01:48,950 --> 00:01:54,200
the exact error, because if we take a look at the errors, we have a bunch of them and actually doing

29
00:01:54,200 --> 00:01:55,910
this project will add one more.

30
00:01:56,360 --> 00:02:03,890
So we have one for bad request the amount found on on authenticated and since in the index address,

31
00:02:04,340 --> 00:02:05,810
we're exporting all of them.

32
00:02:06,050 --> 00:02:06,980
We have few options.

33
00:02:07,490 --> 00:02:14,840
Either we can restructure them in file or I think it's going to be easier if we just go here with Konst

34
00:02:15,170 --> 00:02:17,180
custom error.

35
00:02:18,050 --> 00:02:21,470
And remember, this is an object, so every time we'll need to use them.

36
00:02:21,680 --> 00:02:25,160
I'll just go with Dot and then I'll look for that specific error.

37
00:02:25,670 --> 00:02:30,260
In my opinion, it's just easier instead of the structuring right here.

38
00:02:30,650 --> 00:02:34,490
But if you prefer that syntax instead, of course, you can do so as well.

39
00:02:34,910 --> 00:02:37,460
And in this case, we're looking for the errors.

40
00:02:37,910 --> 00:02:39,740
So again, let's go to levels up.

41
00:02:40,310 --> 00:02:44,270
And since we're exporting everything from index, we don't need to do anything else.

42
00:02:44,720 --> 00:02:50,750
Now, eventually, we'll be getting some things from the UTOS folder, which we haven't created, but

43
00:02:50,750 --> 00:02:52,430
we're not going to worry about it right now.

44
00:02:52,980 --> 00:02:59,000
And first, we just need to remember that everything is going to be accessible for us in that body.

45
00:02:59,810 --> 00:03:02,600
So the client is going to be sending us a jahouh.

46
00:03:03,230 --> 00:03:10,100
And since we have set up here correctly, the middleware, remember that was expressed JSON or have

47
00:03:10,100 --> 00:03:10,760
access to it.

48
00:03:11,120 --> 00:03:17,660
So therefore we can go back through the author controller and you can simply right away target my user

49
00:03:18,170 --> 00:03:22,340
and remember that it is asynchronous, so we need to use a weight.

50
00:03:22,790 --> 00:03:26,660
So let's go here with constant user is equal to.

51
00:03:27,200 --> 00:03:33,680
And then we stick or wait and it go with the user and then create.

52
00:03:33,800 --> 00:03:34,790
That was the method name.

53
00:03:35,180 --> 00:03:37,970
And then we're just passing rec and body.

54
00:03:38,450 --> 00:03:42,230
And like I said, only, well, this thing would just send back everything.

55
00:03:42,770 --> 00:03:45,410
We're going to go with a resident and status.

56
00:03:46,310 --> 00:03:49,010
So that is going to be equal to the status codes.

57
00:03:49,220 --> 00:03:53,520
And let's just go with created since that is two hundred and one.

58
00:03:54,050 --> 00:03:55,010
I'm Jason.

59
00:03:55,460 --> 00:03:59,360
And then let me just bask in the entire user for the time being.

60
00:03:59,960 --> 00:04:04,900
So let me navigate back to the API that confession and we'll show you what we need to send.

61
00:04:05,540 --> 00:04:09,680
So if we take a look at our three routes, the one that we're working on is register.

62
00:04:10,040 --> 00:04:14,960
And here you want to send name, email and the password.

63
00:04:15,110 --> 00:04:19,970
And if you want, you can just copy these values to make it faster, which is exactly what I'm going

64
00:04:19,970 --> 00:04:20,300
to do.

65
00:04:21,480 --> 00:04:29,250
And in there, I'll for the register, which, by the way, I didn't give it the name, so register

66
00:04:29,760 --> 00:04:32,250
and user, you want to go with body.

67
00:04:32,790 --> 00:04:36,990
There are, it is going to be JSON and we'll just set it up over here.

68
00:04:37,410 --> 00:04:41,700
Once we send, we should add back our new user.

69
00:04:42,150 --> 00:04:46,290
And if we do, we are in good shape and we can proceed to the next step.

