1
00:00:09,010 --> 00:00:10,150
Welcome back.

2
00:00:10,180 --> 00:00:14,060
Now our MVC design pattern is complete.

3
00:00:14,080 --> 00:00:21,790
It's time to fill up with the logic by creating employee facing or employee delete employee and add

4
00:00:21,790 --> 00:00:23,140
date employee.

5
00:00:23,470 --> 00:00:30,250
So inside the uterus we have a function to connect to MongoDB, as I said.

6
00:00:30,400 --> 00:00:36,340
And then on the server file I require the function to connect MongoDB.

7
00:00:36,370 --> 00:00:42,100
So now it's time for us to interact with MongoDB using our controller.

8
00:00:42,130 --> 00:00:44,230
So now let's go to the controller.

9
00:00:44,230 --> 00:00:46,930
And for the first one here, that is great.

10
00:00:46,960 --> 00:00:54,910
Let's go ahead and then require the model as an employee in case the auto import isn't working.

11
00:00:54,940 --> 00:00:56,950
Let me show you some cool trick here.

12
00:00:57,220 --> 00:01:02,350
So go back to the file where you want to have the auto import receive it.

13
00:01:02,350 --> 00:01:06,080
And now let's get back to the file where you want to require it.

14
00:01:06,100 --> 00:01:12,910
And here, if I make this of employee and there we go, I have the employee.

15
00:01:13,270 --> 00:01:15,770
So now inside the controller.

16
00:01:15,790 --> 00:01:16,790
Here we go.

17
00:01:16,810 --> 00:01:19,000
So here we make this, of course.

18
00:01:19,000 --> 00:01:22,960
And then the employee is equal to a waste.

19
00:01:22,960 --> 00:01:25,930
And then the employee model dot creates.

20
00:02:07,440 --> 00:02:09,780
Now everything is correct.

21
00:02:09,900 --> 00:02:15,840
So last thing is I need to send the response back to the user as an employee.

22
00:02:16,080 --> 00:02:19,200
So now it's time to test our endpoint.

23
00:02:19,200 --> 00:02:20,650
That is our controller.

24
00:02:20,670 --> 00:02:23,550
So here we go inside the create.

25
00:02:23,550 --> 00:02:31,230
So here we pass in the name of the employee and our code is one as John Doe.

26
00:02:34,930 --> 00:02:37,210
And the city.

27
00:02:40,000 --> 00:02:43,720
Achara and is married.

28
00:02:47,430 --> 00:02:48,510
Is it true?

29
00:02:48,840 --> 00:02:51,450
And then salary?

30
00:02:55,500 --> 00:02:57,460
It going to be as $1,000.

31
00:02:57,510 --> 00:02:58,740
So let's get set.

32
00:02:59,460 --> 00:03:03,660
And you can see that I'm able to create a user.

