1
00:00:09,120 --> 00:00:10,200
In this video.

2
00:00:10,200 --> 00:00:17,250
Let's finish up with the employee database by implementing what is called deleting an employee.

3
00:00:17,670 --> 00:00:20,040
So back to the controller.

4
00:00:20,160 --> 00:00:21,460
So here we go.

5
00:00:21,480 --> 00:00:23,160
Let's collapse this one.

6
00:00:23,160 --> 00:00:28,920
Or we can even copy the same code here and now inside the delete.

7
00:00:28,920 --> 00:00:29,220
How?

8
00:00:29,220 --> 00:00:30,090
Bring it here.

9
00:00:30,330 --> 00:00:38,190
The difference here is going to be the mongoose method going to be fine by it and delete and we are

10
00:00:38,190 --> 00:00:38,670
done.

11
00:00:39,090 --> 00:00:39,540
Yes.

12
00:00:39,540 --> 00:00:44,080
So for this one, I don't want to send back the deleted employee.

13
00:00:44,100 --> 00:00:49,830
But let's say that in your front end you want to display the deleted employee, you can send back the

14
00:00:49,830 --> 00:00:50,250
response.

15
00:00:50,280 --> 00:00:51,610
But for me, no.

16
00:00:51,630 --> 00:00:54,930
So I would say employee.

17
00:00:57,140 --> 00:01:01,460
Has been deleted successfully.

18
00:01:02,900 --> 00:01:03,890
And that is it.

19
00:01:04,069 --> 00:01:08,690
So let me create an employee and then I'll go ahead and then delete that.

20
00:01:08,690 --> 00:01:10,490
So I'll call this one as Lily.

21
00:01:11,090 --> 00:01:13,000
And here we go.

22
00:01:13,010 --> 00:01:14,360
Let me hit send.

23
00:01:15,020 --> 00:01:17,360
Now let me find our employees.

24
00:01:17,360 --> 00:01:20,090
You can see we have three employees.

25
00:01:20,570 --> 00:01:22,560
So we have John Geneva.

26
00:01:22,580 --> 00:01:23,330
And then Lily.

27
00:01:23,330 --> 00:01:29,090
I want to remove Lily or I want to remove John Doe, so I'll copy this one.

28
00:01:29,090 --> 00:01:34,430
And now let me locate the delete and I'll pass in the valid ID and hit send.

29
00:01:34,550 --> 00:01:37,910
Now employee has been deleted successfully.

30
00:01:38,180 --> 00:01:43,210
If I fetch our employees we can see that I go back to work and leave it.

31
00:01:43,400 --> 00:01:44,750
So that is it.

32
00:01:44,750 --> 00:01:45,110
Guy.

33
00:01:45,110 --> 00:01:53,120
So here ends the complete section and express routing and then the MVC design pattern.

34
00:01:53,150 --> 00:01:59,300
As we move on, we are going to build a complex application and that is income and expenses tracker

35
00:01:59,300 --> 00:02:03,440
application using React and Node.js.

36
00:02:03,440 --> 00:02:06,020
All right, let's go Rockin the Nest video.

