1
00:00:00,210 --> 00:00:03,220
All right, so we're clear we get method.

2
00:00:03,750 --> 00:00:09,280
That's how we can read their how or how we can add data onto the server.

3
00:00:09,720 --> 00:00:11,880
So how we can insert data.

4
00:00:12,330 --> 00:00:15,990
And not to do that, we need to use a post method.

5
00:00:16,560 --> 00:00:22,080
But it's not like I can somehow configure a browser and start making post requests.

6
00:00:22,500 --> 00:00:24,910
Fortunately, that's not how it works.

7
00:00:25,140 --> 00:00:28,200
That's why I provided a little bit of help.

8
00:00:28,530 --> 00:00:34,080
Now, keep in mind one thing we're after we set up a post method effectively.

9
00:00:34,080 --> 00:00:40,740
Once we take a look at two flavors of how we can setup post request, we will install one more tool,

10
00:00:41,610 --> 00:00:49,320
which is going to be crucial in our express server development, which is just going to allow us to

11
00:00:49,680 --> 00:00:52,140
test everything much faster.

12
00:00:52,560 --> 00:01:00,300
But since for the post, I do want to show you two flavors that we can have will use a little bit of

13
00:01:00,300 --> 00:01:02,900
static data, meaning there's an app that I prepared.

14
00:01:02,910 --> 00:01:09,180
But don't worry, it's not like you'll have to do that each and every time to test any of these methods.

15
00:01:09,180 --> 00:01:11,890
And you'll see what I'm talking about in the following videos.

16
00:01:12,240 --> 00:01:15,510
So first, let's start by jogging our memory a bit.

17
00:01:16,170 --> 00:01:25,110
We have abductor's now what app that uses doing is just plage the middleware to all our around.

18
00:01:25,440 --> 00:01:25,860
Correct.

19
00:01:26,040 --> 00:01:31,230
And I also mentioned that we have this option of setting up a public folder.

20
00:01:32,010 --> 00:01:34,050
Now we can call whatever we want.

21
00:01:34,050 --> 00:01:43,290
But for this method example, I prepared a method that public, as you can see, it is just a folder

22
00:01:43,620 --> 00:01:47,940
with indexation amount with Joske, email some access.

23
00:01:48,240 --> 00:01:53,200
And once we navigate there, of course, I'll show you how the functionality works.

24
00:01:53,610 --> 00:02:00,210
So this is just prepared so we can test those other methods, meaning more specifically the post method,

25
00:02:00,480 --> 00:02:05,460
because we cannot simply just perform a post request from the browser.

26
00:02:05,700 --> 00:02:10,590
So first, let's set up that method public as our public folder.

27
00:02:11,370 --> 00:02:12,360
That's step number one.

28
00:02:12,370 --> 00:02:16,580
So let's set it up as our static assets and not do that.

29
00:02:16,800 --> 00:02:22,840
I'm just going to add first a comment and I'll say assets and then I'm going to go with an app that

30
00:02:22,870 --> 00:02:24,040
use again.

31
00:02:24,090 --> 00:02:25,680
Remember, that is our method.

32
00:02:26,010 --> 00:02:31,830
And this is going to be a built in middleware and the name is Express Static.

33
00:02:32,130 --> 00:02:34,740
So I just grab my express instance.

34
00:02:34,950 --> 00:02:37,200
I look for the method of static.

35
00:02:37,380 --> 00:02:40,890
And if you remember, we just need to provide here a path.

36
00:02:41,280 --> 00:02:47,700
And instead of going public or static, like I showed you previously, I'm just going to go forward

37
00:02:47,700 --> 00:02:57,810
slash and then methods and then public, because this is where I set up my static files for these examples.

38
00:02:58,110 --> 00:02:59,010
We invoke it.

39
00:02:59,880 --> 00:03:03,610
Now, if we go to the homepage, shouldn't get this error.

40
00:03:03,870 --> 00:03:12,240
So once you invoke there it is, we have a somewhat decent looking at the e-mail file with two options.

41
00:03:12,540 --> 00:03:20,820
We have this JavaScript option, which we're going to cover second and first one is going to be a traditional,

42
00:03:21,120 --> 00:03:22,260
for example.

43
00:03:22,620 --> 00:03:31,950
And again, the reason why we do that is because you cannot simply just configure your browser to perform

44
00:03:32,250 --> 00:03:33,580
a post request.

45
00:03:33,870 --> 00:03:41,730
You either need to use a tool which you are going to install by the name of Postman or insomnia is another

46
00:03:41,730 --> 00:03:42,390
popular one.

47
00:03:42,870 --> 00:03:47,430
Or you need to set up basically a working application.

48
00:03:47,730 --> 00:03:52,830
And if you take a look and the methods public, we have this working application.

