1
00:00:04,790 --> 00:00:12,880
Welcome to another important concept and that is express media where.

2
00:00:13,790 --> 00:00:23,870
To better understand express you need to understand Major World because Express is all about Meadow

3
00:00:23,870 --> 00:00:24,530
World.

4
00:00:24,740 --> 00:00:29,180
So let's see what Express Meadow World is all about.

5
00:00:29,390 --> 00:00:38,330
Where Express Meadow works are functions that have access to the request object and then the response

6
00:00:38,330 --> 00:00:39,080
object.

7
00:00:39,950 --> 00:00:45,680
If a function can have access to the request object and then the response object.

8
00:00:45,710 --> 00:00:54,800
It tells you how important it is and with the same word it can be used to modify the request object

9
00:00:54,800 --> 00:01:01,790
before they are passed to the next meadow world or before it can get into our route.

10
00:01:02,210 --> 00:01:06,800
So let's see importance of many words and some of the use cases here.

11
00:01:07,370 --> 00:01:13,700
Well, one of the use cases of many words is to implement what is called authorization.

12
00:01:14,240 --> 00:01:18,440
There is differences between authorization and authentication.

13
00:01:18,920 --> 00:01:26,210
Authentication simply means that allowing a user to log in into your system with the right credentials,

14
00:01:26,300 --> 00:01:35,150
email and password if the details are valid and after logging in, what do you want the user to take

15
00:01:35,150 --> 00:01:36,500
inside your application?

16
00:01:36,770 --> 00:01:39,260
And that is what you call authorization.

17
00:01:39,260 --> 00:01:43,280
And we can use middleware to implement authorization.

18
00:01:43,460 --> 00:01:50,780
And after that we can also implement middleware to do what is called login, meaning we can display

19
00:01:50,780 --> 00:01:57,380
custom messages upon each request and we can also use middleware for error handling.

20
00:01:57,380 --> 00:02:00,020
And you talk about all these ones.

21
00:02:00,290 --> 00:02:06,170
After that, we can use middleware to implement what is called rate limiting.

22
00:02:06,530 --> 00:02:14,630
This simply means that let's say we have an endpoint or route for fetching or posts, we can implement

23
00:02:14,630 --> 00:02:20,660
it in such a way that a user can make a request five times that endpoint.

24
00:02:20,660 --> 00:02:23,750
If you make a request, that list is six times.

25
00:02:23,750 --> 00:02:31,100
We are going to, through errors that you have, exceed the request limit and we can use express middleware

26
00:02:31,100 --> 00:02:32,750
to implement that.

27
00:02:32,750 --> 00:02:37,430
You see how awesome middleware is and not all.

28
00:02:37,430 --> 00:02:42,290
We can use middleware to implement what is called data validation.

29
00:02:42,560 --> 00:02:49,490
So for the application that we built, we haven't implement what is called validation, whether the

30
00:02:49,490 --> 00:02:57,440
user is providing the right data or not, and we can use express middleware to implement data validation.

31
00:02:57,680 --> 00:03:05,270
And the cool part about Express middleware is that we can use you to implement any business logic.

32
00:03:05,270 --> 00:03:10,370
So if you understand middleware, you can do a lot of in your application.

33
00:03:10,490 --> 00:03:16,610
So let's say that if your account is on a starter account, then you can create, let's see, five posts

34
00:03:16,610 --> 00:03:17,810
or three posts.

35
00:03:18,080 --> 00:03:25,340
And if your account is a account, then we can allow you to create unlimited posts and we can get that

36
00:03:25,340 --> 00:03:28,430
one done using what is called medium well.

37
00:03:28,790 --> 00:03:37,130
The next video, let's talk more about how middleware works and the next middleware that we spoke about

38
00:03:37,130 --> 00:03:41,390
in the previous video, which is this next module.

39
00:03:41,420 --> 00:03:43,940
Let's get into that in the next video.

