1
00:00:02,070 --> 00:00:05,620
Now, before we now dive into building APIs

2
00:00:05,620 --> 00:00:08,610
and how we can build our own APIs and services,

3
00:00:08,610 --> 00:00:11,810
there is one very important differentiation

4
00:00:11,810 --> 00:00:14,493
and clarification which I have to make here.

5
00:00:15,590 --> 00:00:17,500
In the past in this course,

6
00:00:17,500 --> 00:00:21,930
we often also used third-party JavaScript packages

7
00:00:21,930 --> 00:00:24,580
like Express or the Stripe package.

8
00:00:24,580 --> 00:00:27,200
And I did mention that those packages

9
00:00:27,200 --> 00:00:30,880
in the end also could be called services that we use

10
00:00:30,880 --> 00:00:32,820
because they provide certain features

11
00:00:32,820 --> 00:00:34,790
which we use in our project.

12
00:00:34,790 --> 00:00:37,680
And that those packages also had an API

13
00:00:37,680 --> 00:00:40,200
because an API is just a general term

14
00:00:40,200 --> 00:00:43,020
for describing the bridge between your code

15
00:00:43,020 --> 00:00:47,100
to a third-party package or web service.

16
00:00:47,100 --> 00:00:48,900
So therefore, we can of course say

17
00:00:48,900 --> 00:00:51,700
that when we talk about services and APIs,

18
00:00:51,700 --> 00:00:54,400
we could talk about third-party packages

19
00:00:54,400 --> 00:00:56,690
which offer a certain API to us

20
00:00:56,690 --> 00:01:00,630
or web services that expose certain URLs

21
00:01:00,630 --> 00:01:02,920
to which we can send requests.

22
00:01:02,920 --> 00:01:06,450
And as in the case of Stripe, that might also be connected

23
00:01:06,450 --> 00:01:08,610
and you might have a JavaScript package

24
00:01:08,610 --> 00:01:10,700
offered by a service provider,

25
00:01:10,700 --> 00:01:15,150
which talks to that service web API under the hood.

26
00:01:15,150 --> 00:01:17,940
That's what the Stripe package did for us.

27
00:01:17,940 --> 00:01:20,890
We didn't send requests directly to Stripe

28
00:01:20,890 --> 00:01:22,600
from inside our code there.

29
00:01:22,600 --> 00:01:26,053
Instead, we used the Stripe package, which did that for us.

30
00:01:27,360 --> 00:01:29,760
Now, in case of a JavaScript package,

31
00:01:29,760 --> 00:01:33,430
the API would be the collection of methods and objects

32
00:01:33,430 --> 00:01:36,090
and properties that are documented

33
00:01:36,090 --> 00:01:39,750
and that we can use in our code to use the functionalities

34
00:01:39,750 --> 00:01:41,980
provided by that package.

35
00:01:41,980 --> 00:01:44,710
So that's what this package would expose them.

36
00:01:44,710 --> 00:01:47,660
And if we would wanna build such a package on our own,

37
00:01:47,660 --> 00:01:50,850
we would have to dive deeper into frontend

38
00:01:50,850 --> 00:01:53,530
and especially JavaScript development

39
00:01:53,530 --> 00:01:55,790
since we would need extra tools

40
00:01:55,790 --> 00:01:58,130
and would need to use npm,

41
00:01:58,130 --> 00:02:01,960
this tool which was installed together with Node.js

42
00:02:01,960 --> 00:02:04,300
to build such a package.

43
00:02:04,300 --> 00:02:07,000
It's possible, but beyond the scope of this course,

44
00:02:07,000 --> 00:02:09,180
and definitely more advanced.

45
00:02:09,180 --> 00:02:10,259
Building such a package

46
00:02:10,259 --> 00:02:12,560
is something you can do as a web developer,

47
00:02:12,560 --> 00:02:15,160
but it also requires many other skills,

48
00:02:15,160 --> 00:02:17,940
which are not necessarily skills you need to have

49
00:02:17,940 --> 00:02:19,930
as a web developer.

50
00:02:19,930 --> 00:02:21,460
So therefore, that's not the part

51
00:02:21,460 --> 00:02:23,760
on which we will focus here.

52
00:02:23,760 --> 00:02:25,830
Instead, in this course section,

53
00:02:25,830 --> 00:02:28,230
we'll do something which you'll have to do a lot

54
00:02:28,230 --> 00:02:32,890
as a web developer, we'll build a URL-based API,

55
00:02:32,890 --> 00:02:36,690
so a web service that exposes certain URLs

56
00:02:36,690 --> 00:02:38,710
to which requests can be sent.

57
00:02:38,710 --> 00:02:41,010
And then for those incoming requests,

58
00:02:41,010 --> 00:02:43,290
certain actions will be triggered.

59
00:02:43,290 --> 00:02:46,630
And to be precise, those actions would be triggered

60
00:02:46,630 --> 00:02:51,010
by sending requests to certain so-called endpoints,

61
00:02:51,010 --> 00:02:54,880
which is a certain URL reached by a request

62
00:02:54,880 --> 00:02:59,000
that has a clearly specified HTTP method:

63
00:02:59,000 --> 00:03:01,450
get, post, patch, put, delete.

64
00:03:01,450 --> 00:03:03,290
You learned about them before.

65
00:03:03,290 --> 00:03:06,850
They will become important again in this course section.

66
00:03:06,850 --> 00:03:10,430
Now the key thing about such a URL-based API

67
00:03:10,430 --> 00:03:14,090
is that different requests sent to different URLs

68
00:03:14,090 --> 00:03:18,380
with different HTTP methods will trigger different actions

69
00:03:18,380 --> 00:03:21,600
and therefore get back different responses.

70
00:03:21,600 --> 00:03:22,720
And here, of course,

71
00:03:22,720 --> 00:03:24,950
you need a lot of web development skills

72
00:03:24,950 --> 00:03:28,090
because as you will see throughout this course section,

73
00:03:28,090 --> 00:03:30,270
we will still apply what you learned.

74
00:03:30,270 --> 00:03:33,480
You don't need to learn a bunch of brand new things.

75
00:03:33,480 --> 00:03:36,450
Instead, we'll just tweak a couple of smaller things

76
00:03:36,450 --> 00:03:40,800
here and there and introduce a few new concepts.

77
00:03:40,800 --> 00:03:44,410
But generally, we'll still be building a web backend

78
00:03:44,410 --> 00:03:47,350
with any programming language of your choice,

79
00:03:47,350 --> 00:03:51,020
Node.js in this example here in this course section,

80
00:03:51,020 --> 00:03:55,160
and then we can take our existing web developer skills

81
00:03:55,160 --> 00:03:58,180
and build a brand new thing with it,

82
00:03:58,180 --> 00:04:00,313
an API instead of a website.

