1
00:00:01,110 --> 00:00:06,230
In this video, we are going to implement creation of a post.

2
00:00:06,240 --> 00:00:11,490
So the first step is that we need to render the form for post creation.

3
00:00:11,490 --> 00:00:17,910
So first of all, let's get to the number and target the link for new post.

4
00:00:18,180 --> 00:00:21,630
When I click on this one, I want to display a form.

5
00:00:21,630 --> 00:00:24,120
Likewise this button as well.

6
00:00:24,120 --> 00:00:31,290
So first of all, let's have the template and as always I'll provide the template for you.

7
00:00:31,290 --> 00:00:36,870
So I'm going to copy the template and put it inside the post views.

8
00:00:36,870 --> 00:00:38,730
And here we go.

9
00:00:38,730 --> 00:00:44,550
Inside That next step is I need to rename this one to Aegis.

10
00:00:44,550 --> 00:00:46,710
That is Dot E J's.

11
00:00:48,520 --> 00:00:50,510
Next step is about the CSIS.

12
00:00:50,530 --> 00:00:56,140
It used the same CSIS for the form, so let me locate the link.

13
00:00:56,140 --> 00:00:59,510
And indeed, everything is fine for here.

14
00:00:59,530 --> 00:01:03,130
So let me rename this one to post correction.

15
00:01:03,910 --> 00:01:07,390
Now let's go ahead and then render the post form.

16
00:01:07,390 --> 00:01:09,490
So let me remove one T here.

17
00:01:09,610 --> 00:01:13,150
Next step is we need to create a route for that.

18
00:01:13,150 --> 00:01:21,250
So let me collapse the opening taps and let's go to route post and here we go.

19
00:01:22,010 --> 00:01:27,430
So before the API, end point or root, let me add comment here.

20
00:01:27,440 --> 00:01:28,490
Core forms.

21
00:01:29,180 --> 00:01:32,180
Ain't going to be as post.

22
00:01:32,750 --> 00:01:34,280
Don't get.

23
00:01:35,380 --> 00:01:38,500
And then the form going to be as great.

24
00:01:39,460 --> 00:01:53,080
Post form and then I'll pass in the callback function req and response and press dot render.

25
00:01:54,230 --> 00:01:59,720
And I went to render the post form that is post and forward slash.

26
00:01:59,750 --> 00:02:03,730
Let's have a look at post dot edges.

27
00:02:03,740 --> 00:02:07,610
So let's make use of add posts.

28
00:02:07,820 --> 00:02:13,610
And then I want to pass in the error property in case we have one.

29
00:02:13,610 --> 00:02:16,070
So by default is empty.

30
00:02:16,310 --> 00:02:19,160
Next step is let's target this one.

31
00:02:19,160 --> 00:02:24,800
So I'll copy this link and let's go to the nav bar where we have the pattern.

32
00:02:24,800 --> 00:02:28,430
So views, postures and here we go.

33
00:02:28,670 --> 00:02:30,800
And this is a link for that.

34
00:02:30,800 --> 00:02:37,970
So instead of this one, we are going to use this one as forward slash get put form.

35
00:02:37,970 --> 00:02:44,630
So we're going to be as API for a slash post for a slash the new URL.

36
00:02:44,870 --> 00:02:55,120
So when I refresh the page and I click on this where you can see that cannot get the form API.

37
00:02:55,130 --> 00:03:02,120
So it means that I'm not doing something right, It's supposed to be version one forward slash post.

38
00:03:05,170 --> 00:03:05,830
Refresh.

39
00:03:05,830 --> 00:03:07,390
It ain't new.

40
00:03:07,660 --> 00:03:09,880
And we have the form.

41
00:03:09,880 --> 00:03:16,280
And for this we are expanding the title, the category, the body, and then the image.

42
00:03:16,300 --> 00:03:21,900
So let's look at the structure for the HTML that is the output form.

43
00:03:21,910 --> 00:03:26,670
So let's look at the form and here is the form.

44
00:03:26,680 --> 00:03:30,180
You can see that we are passing in the title.

45
00:03:30,190 --> 00:03:31,690
The name is that.

46
00:03:31,690 --> 00:03:37,120
And then for the categories, these are the categories that we have for the HTML.

47
00:03:37,150 --> 00:03:43,510
But remember, we need to use the accepted category based on the model.

48
00:03:43,540 --> 00:03:48,550
So if you go to model last post, let's look at the categories for that.

49
00:03:49,500 --> 00:03:53,530
And you can see that these are the categories that we are expanding.

50
00:03:53,550 --> 00:03:58,440
So I'll put this one side by side as a route map.

51
00:03:58,470 --> 00:04:02,730
So now I'm going to replace this one.

52
00:04:02,730 --> 00:04:04,610
That is the category with this.

53
00:04:04,620 --> 00:04:09,400
So let me reduce the font size a little bit to have some room to work with.

54
00:04:09,420 --> 00:04:12,270
So likewise, this one also.

55
00:04:12,450 --> 00:04:20,970
So first of all, the title is the same, the category we have the label and then this select and I

56
00:04:20,970 --> 00:04:25,320
have the name as category because that's what we specified here.

57
00:04:25,560 --> 00:04:29,760
So the first value for this one is going to be React.

58
00:04:29,780 --> 00:04:37,020
JS So I'm going to copy this one and the value must be this because this is what is going to send to

59
00:04:37,020 --> 00:04:37,970
the back end.

60
00:04:37,980 --> 00:04:41,270
So I can provide this one as React.

61
00:04:41,280 --> 00:04:48,390
JS And then the next one going to be the smell as that.

62
00:04:48,390 --> 00:04:53,070
And here I can use any name, a HTML.

63
00:05:11,690 --> 00:05:13,130
And there you go.

64
00:05:13,520 --> 00:05:14,090
All right.

65
00:05:14,090 --> 00:05:16,360
So now we got done with the categories.

66
00:05:16,370 --> 00:05:19,430
So the next one going to be the body.

67
00:05:19,460 --> 00:05:23,330
So it's not body, but instead it's called description.

68
00:05:23,330 --> 00:05:28,730
So I'm going to copy this one and replace the name with the body.

69
00:05:28,820 --> 00:05:32,630
And then the image, I think is image, right?

70
00:05:32,630 --> 00:05:34,010
Yeah, is image.

71
00:05:34,310 --> 00:05:35,990
Let me remove the comment.

72
00:05:35,990 --> 00:05:37,970
And there we go.

73
00:05:37,970 --> 00:05:40,700
Now I can close the module.

74
00:05:41,000 --> 00:05:43,310
Let's go ahead and then try again.

75
00:05:43,310 --> 00:05:45,950
Let's refresh and let's look at the categories.

76
00:05:45,950 --> 00:05:50,090
And these are the categories for the project or the post.

77
00:05:50,540 --> 00:05:55,040
The next one is I want to render the NAVA like y the photo.

78
00:05:55,070 --> 00:06:04,970
So if I go to the any page, for example, index, I'm going to copy the purchase for that number,

79
00:06:04,970 --> 00:06:10,040
which is this, copy that and I'll paste it here.

80
00:06:11,600 --> 00:06:14,570
And then for the phone to screw it down.

81
00:06:14,570 --> 00:06:22,070
And I have the photo here and let me also piece it down here as that.

82
00:06:22,340 --> 00:06:24,530
Now let's refresh it.

83
00:06:25,420 --> 00:06:27,030
Where we have an error.

84
00:06:27,040 --> 00:06:31,120
The problem is the path to the partials or the photon.

85
00:06:31,390 --> 00:06:34,420
So here the path has changed.

86
00:06:34,420 --> 00:06:37,510
So let's bring dot, dot forward slash.

87
00:06:37,660 --> 00:06:41,620
And down here is going to be dot, dot, forward, slash.

88
00:06:41,620 --> 00:06:43,060
And it will fix that.

89
00:06:43,060 --> 00:06:44,500
So let's see.

90
00:06:44,500 --> 00:06:46,140
And we have the number.

91
00:06:46,150 --> 00:06:49,180
Likewise, the photon down here.

92
00:06:49,390 --> 00:06:53,710
The next step is about making the actual HTTP request.

93
00:06:53,710 --> 00:06:57,820
So here is a HTML, but not a T and L.

94
00:06:58,870 --> 00:06:59,470
Perfect.

95
00:06:59,470 --> 00:07:03,370
So in this video, let's go ahead and make the actual request.

