1
00:00:00,660 --> 00:00:06,720
In this lesson we will be connecting the front end side to the back and side open the server API file.

2
00:00:06,870 --> 00:00:10,260
Let's start our code under the game shake function.

3
00:00:10,260 --> 00:00:17,590
Here we will be creating an API where we can command the back end to start the course set the decorator.

4
00:00:17,700 --> 00:00:24,380
This time the path will be API shakes start next as the methods.

5
00:00:24,560 --> 00:00:34,290
Usually this will be post but we will add get as well so we can debug we define shakes start the course

6
00:00:34,290 --> 00:00:39,110
I.D. will be set to request args get followed by I.D..

7
00:00:40,800 --> 00:00:45,160
So we can get the I.D. if the method is set to post.

8
00:00:45,220 --> 00:00:48,180
We will be using form instead of ARGs.

9
00:00:48,280 --> 00:00:54,060
In this lesson we'll be using get so I'll comment out on this line.

10
00:00:54,100 --> 00:01:03,520
Next we need to get the course set variable course to get courses in it and course i.e. next course

11
00:01:03,520 --> 00:01:06,680
start and return.

12
00:01:06,690 --> 00:01:12,220
Jason ify result to started followed by two hundred okay response.

13
00:01:12,990 --> 00:01:16,140
Once the course starts the phone will be shaped.

14
00:01:16,140 --> 00:01:22,860
Here we need to create an API that will send a request to the back end once the phone has been checked.

15
00:01:22,890 --> 00:01:24,420
Set the decorator.

16
00:01:24,420 --> 00:01:27,900
This time the path will be API shake.

17
00:01:27,960 --> 00:01:33,380
Run methods will again be both get and post.

18
00:01:33,930 --> 00:01:37,260
Let's copy the codes to get the course I.D. from the previous code.

19
00:01:38,550 --> 00:01:40,370
Set the function name to shake.

20
00:01:40,380 --> 00:01:42,990
Run to run this function.

21
00:01:43,010 --> 00:01:53,570
We set to course run the return we'll be set to J sonnet 5 followed by the lapse time of course elapsed

22
00:01:54,260 --> 00:02:01,000
status with the core status and also to check if the drone is running on the course or not.

23
00:02:01,250 --> 00:02:09,670
These information will be returned to the front end and not to forget the 200 OK once you've finished

24
00:02:09,670 --> 00:02:12,610
your codes we'll be running these codes.

25
00:02:12,610 --> 00:02:19,420
We won't be accessing with the phones yet we can use the Mac browser to access the you or else turn

26
00:02:19,420 --> 00:02:22,480
on your drone and let's run this code.

27
00:02:22,480 --> 00:02:25,330
It'll be much easier to understand what is going on.

28
00:02:25,360 --> 00:02:32,220
If we look into the course P Why file click on the U.R.L. in the U.R.L..

29
00:02:32,370 --> 00:02:37,590
I want you to add slash API slash Sheik slash start.

30
00:02:37,920 --> 00:02:41,430
Question mark IDR equal 1.

31
00:02:41,460 --> 00:02:43,650
Here we started the course.

32
00:02:43,650 --> 00:02:48,780
Now let's change that you are able to run and hit the return button.

33
00:02:48,780 --> 00:02:55,650
You can see that the drone takes off once the drone is in the air hit the refresh button so the status

34
00:02:55,650 --> 00:02:59,710
will go up as the status reaches 10.

35
00:02:59,730 --> 00:03:07,860
The drone will rotate clockwise 90 degrees go on refreshing and at status 15 again will rotate.

36
00:03:07,980 --> 00:03:14,650
Then we hit status 20 so the drone rotates again once the status hits 25.

37
00:03:14,700 --> 00:03:22,800
The drone rotates and we'll be facing forward go on refreshing and once the status reaches 30 it will

38
00:03:22,800 --> 00:03:26,260
flip to the front at status 40.

39
00:03:26,310 --> 00:03:31,200
The drone will flip back once we hit status 50.

40
00:03:31,230 --> 00:03:36,230
The drone will land and the status will be cleared back to zero.

41
00:03:36,240 --> 00:03:40,470
I hope your drone flight was a success and see you in our next lesson.
