1
00:00:02,110 --> 00:00:04,210
Now in that course section

2
00:00:04,210 --> 00:00:07,870
which I mentioned before where we added Stripe

3
00:00:07,870 --> 00:00:10,930
for handling payments to our online shop,

4
00:00:10,930 --> 00:00:15,080
I already introduced you to services and APIs,

5
00:00:15,080 --> 00:00:16,840
and I explained what that is

6
00:00:16,840 --> 00:00:18,930
and why we might wanna use that.

7
00:00:18,930 --> 00:00:22,450
So you should definitely go through that section first

8
00:00:22,450 --> 00:00:24,833
before you dive into this section here.

9
00:00:25,780 --> 00:00:28,630
I just wanna highlight one specific aspect

10
00:00:28,630 --> 00:00:31,590
on which I didn't focus back then.

11
00:00:31,590 --> 00:00:35,690
In the very first course section of this course,

12
00:00:35,690 --> 00:00:37,720
in the getting started section,

13
00:00:37,720 --> 00:00:40,520
I already mentioned that as a web developer,

14
00:00:40,520 --> 00:00:44,960
we can build websites, sometimes also called web apps,

15
00:00:44,960 --> 00:00:49,260
and that we can also build web services or APIs.

16
00:00:49,260 --> 00:00:51,450
And I now, again, wanna emphasize

17
00:00:51,450 --> 00:00:53,690
what the exact difference is

18
00:00:53,690 --> 00:00:56,600
because that will become important to understand

19
00:00:56,600 --> 00:00:58,820
what we're building in this course section

20
00:00:58,820 --> 00:01:01,020
and how it differs from the websites

21
00:01:01,020 --> 00:01:03,023
we built thus far in the course.

22
00:01:04,120 --> 00:01:07,690
When we build a website, which is essentially what we did

23
00:01:07,690 --> 00:01:09,810
throughout this entire course,

24
00:01:09,810 --> 00:01:12,170
no matter if we had a frontend only

25
00:01:12,170 --> 00:01:14,380
or frontend and backend,

26
00:01:14,380 --> 00:01:19,230
then it's all about ensuring that visitors of our website

27
00:01:19,230 --> 00:01:21,350
see some HTML page.

28
00:01:21,350 --> 00:01:24,830
It's all about displaying some HTML content

29
00:01:24,830 --> 00:01:27,770
in the browsers of our visitors in the end.

30
00:01:27,770 --> 00:01:29,193
That's the goal here.

31
00:01:30,080 --> 00:01:33,430
And therefore, of course, our responses

32
00:01:33,430 --> 00:01:38,150
that are sent back by our servers contain HTML code,

33
00:01:38,150 --> 00:01:41,870
no matter if it's hard-coded and a static website

34
00:01:41,870 --> 00:01:43,970
or if it's dynamically created

35
00:01:43,970 --> 00:01:47,780
and rendered on the server with help of templates.

36
00:01:47,780 --> 00:01:51,720
Ultimately, HTML code is returned to the visitors

37
00:01:51,720 --> 00:01:54,690
and it's the browsers of our visitors

38
00:01:54,690 --> 00:01:57,480
that will then turn this HTML code

39
00:01:57,480 --> 00:02:00,523
into the website that's displayed to our visitors.

40
00:02:01,720 --> 00:02:05,840
Now, when we built a web service or a so-called API,

41
00:02:05,840 --> 00:02:07,410
and again I'm using these terms

42
00:02:07,410 --> 00:02:09,289
kind of interchangeably here,

43
00:02:09,289 --> 00:02:13,580
then it's not all about displaying a page on the screen.

44
00:02:13,580 --> 00:02:16,040
Instead, it is about exchanging data

45
00:02:16,040 --> 00:02:18,810
and performing certain actions.

46
00:02:18,810 --> 00:02:20,610
When we used Stripe,

47
00:02:20,610 --> 00:02:23,580
it was not about showing a page on the screen,

48
00:02:23,580 --> 00:02:27,080
even though Stripe did give us that checkout page,

49
00:02:27,080 --> 00:02:30,600
but Stripe actually did way more behind the scenes.

50
00:02:30,600 --> 00:02:33,700
It handled this credit card transaction.

51
00:02:33,700 --> 00:02:36,650
It reached out to the credit card provider,

52
00:02:36,650 --> 00:02:39,140
for example, MasterCard or Visa,

53
00:02:39,140 --> 00:02:41,750
so that the charge was made.

54
00:02:41,750 --> 00:02:43,970
That all happened behind the scenes

55
00:02:43,970 --> 00:02:47,530
and these were actions provided by Stripe to us.

56
00:02:47,530 --> 00:02:50,210
So that's what the Stripe service did.

57
00:02:50,210 --> 00:02:53,930
And that's a very common use case for a service.

58
00:02:53,930 --> 00:02:56,760
When we would work with the Google Maps service

59
00:02:56,760 --> 00:02:59,150
for fetching some maps data,

60
00:02:59,150 --> 00:03:01,510
then we would probably get back some data

61
00:03:01,510 --> 00:03:03,220
in the JSON format,

62
00:03:03,220 --> 00:03:05,883
which we could then use in our own website.

63
00:03:06,770 --> 00:03:09,930
So when we deal with web services and APIs,

64
00:03:09,930 --> 00:03:14,190
it's not primarily about getting some HTML code

65
00:03:14,190 --> 00:03:15,980
that should be displayed on the screen.

66
00:03:15,980 --> 00:03:18,030
Instead, it's about exchanging data

67
00:03:18,030 --> 00:03:21,700
and what that service does behind the scenes for us.

68
00:03:21,700 --> 00:03:24,480
And therefore, when we built our own web service,

69
00:03:24,480 --> 00:03:27,190
it will also not be about writing code

70
00:03:27,190 --> 00:03:31,570
that renders templates and returns that as a response.

71
00:03:31,570 --> 00:03:32,430
Instead, it will be

72
00:03:32,430 --> 00:03:35,170
about doing certain things on the server,

73
00:03:35,170 --> 00:03:38,950
storing certain pieces of data in the database, for example,

74
00:03:38,950 --> 00:03:41,910
and it will then be about sending back data,

75
00:03:41,910 --> 00:03:46,540
JSON data as the response instead of HTML code.

76
00:03:46,540 --> 00:03:49,950
And in case you forgot why we might build such services

77
00:03:49,950 --> 00:03:53,950
or why we might use such services, well, as a developer,

78
00:03:53,950 --> 00:03:56,960
there are plenty of services that we might need to use

79
00:03:56,960 --> 00:04:00,730
to build a certain website or service on our own.

80
00:04:00,730 --> 00:04:02,200
We can also build a service

81
00:04:02,200 --> 00:04:05,130
that builds up on another service

82
00:04:05,130 --> 00:04:08,160
so that we can focus on our core business logic

83
00:04:08,160 --> 00:04:11,600
and we don't have to reinvent the wheel all the time.

84
00:04:11,600 --> 00:04:14,780
We can also build our own service and earn money with that

85
00:04:14,780 --> 00:04:16,390
instead of building a website

86
00:04:16,390 --> 00:04:19,310
which might offer content to our users.

87
00:04:19,310 --> 00:04:21,149
So there are different business models

88
00:04:21,149 --> 00:04:23,920
which are possible as a web developer

89
00:04:23,920 --> 00:04:28,093
and web services are just as important as websites.

