1
00:00:00,480 --> 00:00:01,560
Not bad, not bad.

2
00:00:01,589 --> 00:00:09,330
We have general understanding how middle of world works and express and I want to cover the rest of

3
00:00:09,330 --> 00:00:10,890
the HTP methods.

4
00:00:11,370 --> 00:00:19,360
So if you remember, which seems like an eternity ago, we covered the cycle, the message as well as

5
00:00:19,360 --> 00:00:25,650
the response and in request, well, get was by default, reform by browser.

6
00:00:25,950 --> 00:00:28,880
But of course we have other methods as well.

7
00:00:29,220 --> 00:00:33,650
And I also provided a second slide just for these methods.

8
00:00:33,930 --> 00:00:35,870
And here you can see the rest of the methods.

9
00:00:36,210 --> 00:00:43,080
So get it again by default, set up in the browser and this allows us to read data.

10
00:00:43,470 --> 00:00:47,040
Then we have a post that is for inserting data.

11
00:00:47,400 --> 00:00:53,780
So, for example, if we have some kind of API order around, we can add an order.

12
00:00:53,940 --> 00:00:58,250
So a user makes an order and we just place that order on a server.

13
00:00:58,590 --> 00:01:05,510
So of course, eventually we would say that in a database, then we have put if we want to update there

14
00:01:05,670 --> 00:01:09,360
and of course, we also have one for deleting the data.

15
00:01:09,690 --> 00:01:12,270
And before we continue, let me just mention something.

16
00:01:12,870 --> 00:01:15,370
We're not going to process this data.

17
00:01:15,390 --> 00:01:22,590
So, yes, we'll have working examples of post put delete and hopefully I'll be able to convey my message

18
00:01:22,980 --> 00:01:28,590
in a manner where you understand the general setup for rest of the methods.

19
00:01:28,830 --> 00:01:34,050
But since we haven't covered how to connect to the database, we won't persist this data.

20
00:01:34,440 --> 00:01:40,560
Now, I could have when the file system where essentially we are persisting this data by writing in

21
00:01:40,560 --> 00:01:41,010
a file.

22
00:01:41,010 --> 00:01:46,650
But I thought it's a waste of your time because most likely you're going to work with database anyway,

23
00:01:46,950 --> 00:01:48,850
so we might as well skip that part.

24
00:01:49,050 --> 00:01:55,320
So once we understand how we can connect to the database, what are the methods by working with data

25
00:01:55,470 --> 00:02:02,310
in our database, then we'll have a proper example where we're persisting data as well.

26
00:02:02,700 --> 00:02:04,220
And not to kick things off.

27
00:02:04,230 --> 00:02:07,200
I'm going to navigate back to my address again.

28
00:02:07,200 --> 00:02:12,090
The previous example is going to be in the file number 10 middleware options.

29
00:02:12,510 --> 00:02:20,310
And again, we're just removing pretty much everything, starting with Morgenthal right after app and

30
00:02:20,310 --> 00:02:23,730
all the way to app that listen.

31
00:02:23,920 --> 00:02:27,050
OK, so now there's not going to be a home report.

32
00:02:27,060 --> 00:02:30,900
However, I'm going to go with API and people now.

33
00:02:30,900 --> 00:02:32,640
Why do I go with API people?

34
00:02:32,850 --> 00:02:34,560
Because in the data file.

35
00:02:34,740 --> 00:02:38,130
In the data gess where we have the product.

36
00:02:38,990 --> 00:02:46,040
There's also this one people people is an array, each person is an object, there's an ID as well as

37
00:02:46,040 --> 00:02:49,030
the name, as you can see, very simple example.

38
00:02:49,490 --> 00:02:57,410
So with this data, IRA, I would want to showcase how we can read this data, how we can add, for

39
00:02:57,410 --> 00:03:04,420
example, an extra person using the post, how we can modify the person as well as deleting one.

40
00:03:04,790 --> 00:03:10,720
And now, of course, I want to navigate objects and first I want to get my people.

41
00:03:11,030 --> 00:03:15,350
So we simply go we import our structures right away.

42
00:03:15,530 --> 00:03:22,790
And as a side note, since I might make some modifications, how you let in this case and I'll set it

43
00:03:22,790 --> 00:03:31,010
equal to require some data, hopefully this part is clear since we have covered quite a few times.

44
00:03:31,370 --> 00:03:36,880
And let's start with the one that we already know, and that is going to be a good method.

45
00:03:37,220 --> 00:03:43,880
So I'm going to go with an app that gets like I said, I'll purposely set up my route with a value of

46
00:03:43,880 --> 00:03:45,500
API and people.

47
00:03:45,710 --> 00:03:46,970
So that's going to be my path.

48
00:03:46,970 --> 00:03:50,070
I'll say API and and people.

49
00:03:50,340 --> 00:03:54,600
Now, this is a great method and simply will return this.

50
00:03:54,620 --> 00:03:55,000
All right.

51
00:03:55,220 --> 00:04:03,470
So Rick András and again, I'm just going to go with Araz status, what's called the value of the hundred.

52
00:04:03,740 --> 00:04:05,570
Then let's set up our JSON.

53
00:04:05,840 --> 00:04:09,350
And since I want to be kind to my users, I'll send back the object.

54
00:04:09,620 --> 00:04:12,910
I'll say that the success property is true.

55
00:04:13,250 --> 00:04:14,990
So the request was successful.

56
00:04:15,200 --> 00:04:20,089
And as far as data property, well, I'll set it equal to your people.

57
00:04:20,420 --> 00:04:28,070
So let's navigate back to our browser and we're going to go with five thousand and of course, kind

58
00:04:28,070 --> 00:04:28,560
of get.

59
00:04:28,940 --> 00:04:36,620
So this is going to be four or four if I just go to the home page and instead I have about four API

60
00:04:37,130 --> 00:04:40,310
and I believe the whole path was people like.

61
00:04:40,310 --> 00:04:41,840
So so we run that.

62
00:04:42,820 --> 00:04:50,680
And of course, I zoomed in already massively here, so it means the amount in my browser and we should

63
00:04:50,680 --> 00:04:56,490
see that we're getting our object, the success property is truly beautiful.

64
00:04:56,770 --> 00:05:02,560
And then, of course, we have the data property and in there we have the people's.

65
00:05:02,560 --> 00:05:02,830
All right.

66
00:05:03,160 --> 00:05:04,920
So bunch of people in here.

67
00:05:05,140 --> 00:05:09,600
So, of course, that is our first HTP method.

68
00:05:09,940 --> 00:05:17,470
That is the one where effectively we read the data and like I already have mentioned, probably 20 thousand

69
00:05:17,470 --> 00:05:17,800
times.

70
00:05:18,100 --> 00:05:22,660
That's the default method that the browser performs.

71
00:05:22,690 --> 00:05:31,660
So when you set up a request with your browser, you right away use the verb by the name of GET, and

72
00:05:31,660 --> 00:05:34,180
that's why you can read the data.

