Now in that course section
which I mentioned before where we added Stripe
for handling payments to our online shop,
I already introduced you to services and APIs,
and I explained what that is
and why we might wanna use that.
So you should definitely go through that section first
before you dive into this section here.
I just wanna highlight one specific aspect
on which I didn't focus back then.
In the very first course section of this course,
in the getting started section,
I already mentioned that as a web developer,
we can build websites, sometimes also called web apps,
and that we can also build web services or APIs.
And I now, again, wanna emphasize
what the exact difference is
because that will become important to understand
what we're building in this course section
and how it differs from the websites
we built thus far in the course.
When we build a website, which is essentially what we did
throughout this entire course,
no matter if we had a frontend only
or frontend and backend,
then it's all about ensuring that visitors of our website
see some HTML page.
It's all about displaying some HTML content
in the browsers of our visitors in the end.
That's the goal here.
And therefore, of course, our responses
that are sent back by our servers contain HTML code,
no matter if it's hard-coded and a static website
or if it's dynamically created
and rendered on the server with help of templates.
Ultimately, HTML code is returned to the visitors
and it's the browsers of our visitors
that will then turn this HTML code
into the website that's displayed to our visitors.
Now, when we built a web service or a so-called API,
and again I'm using these terms
kind of interchangeably here,
then it's not all about displaying a page on the screen.
Instead, it is about exchanging data
and performing certain actions.
When we used Stripe,
it was not about showing a page on the screen,
even though Stripe did give us that checkout page,
but Stripe actually did way more behind the scenes.
It handled this credit card transaction.
It reached out to the credit card provider,
for example, MasterCard or Visa,
so that the charge was made.
That all happened behind the scenes
and these were actions provided by Stripe to us.
So that's what the Stripe service did.
And that's a very common use case for a service.
When we would work with the Google Maps service
for fetching some maps data,
then we would probably get back some data
in the JSON format,
which we could then use in our own website.
So when we deal with web services and APIs,
it's not primarily about getting some HTML code
that should be displayed on the screen.
Instead, it's about exchanging data
and what that service does behind the scenes for us.
And therefore, when we built our own web service,
it will also not be about writing code
that renders templates and returns that as a response.
Instead, it will be
about doing certain things on the server,
storing certain pieces of data in the database, for example,
and it will then be about sending back data,
JSON data as the response instead of HTML code.
And in case you forgot why we might build such services
or why we might use such services, well, as a developer,
there are plenty of services that we might need to use
to build a certain website or service on our own.
We can also build a service
that builds up on another service
so that we can focus on our core business logic
and we don't have to reinvent the wheel all the time.
We can also build our own service and earn money with that
instead of building a website
which might offer content to our users.
So there are different business models
which are possible as a web developer
and web services are just as important as websites.