Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,150 --> 00:00:04,664
And that's it for API routes,
2
00:00:04,664 --> 00:00:08,640
another very useful feature Next.js offers to you.
3
00:00:08,640 --> 00:00:10,520
A feature, which you won't need
4
00:00:10,520 --> 00:00:12,460
in every project you're building.
5
00:00:12,460 --> 00:00:15,810
Not every Next website needs API routes.
6
00:00:15,810 --> 00:00:18,900
But if you have some backend functionality
7
00:00:18,900 --> 00:00:22,027
that should be triggered through client side code,
8
00:00:22,027 --> 00:00:23,470
like we're doing it here
9
00:00:23,470 --> 00:00:26,450
for loading feedback or for storing feedback,
10
00:00:26,450 --> 00:00:29,300
then API routes can be super useful
11
00:00:29,300 --> 00:00:31,160
because they allow you to add
12
00:00:31,160 --> 00:00:33,670
extra functionality to your website,
13
00:00:33,670 --> 00:00:36,210
which might rely on an API
14
00:00:36,210 --> 00:00:38,900
like users sign up for a newsletter
15
00:00:38,900 --> 00:00:42,560
without having to build an extra API backend.
16
00:00:42,560 --> 00:00:45,496
Without having to build a totally different project.
17
00:00:45,496 --> 00:00:49,200
Instead, you can easily inject API routes
18
00:00:49,200 --> 00:00:50,500
as we're doing it here
19
00:00:50,500 --> 00:00:54,340
by using this special API folder in the pages folder.
20
00:00:54,340 --> 00:00:56,910
And you can write service side code here,
21
00:00:56,910 --> 00:01:01,910
which is then triggered for requests to these API routes.
22
00:01:02,150 --> 00:01:04,640
And here you learned that you can find out
23
00:01:04,640 --> 00:01:06,908
which kind of request was sent,
24
00:01:06,908 --> 00:01:10,130
that you can extract request body data,
25
00:01:10,130 --> 00:01:12,557
and that you can send back responses
26
00:01:12,557 --> 00:01:15,096
with different status codes
27
00:01:15,096 --> 00:01:18,407
and also with different kinds of data.
28
00:01:18,407 --> 00:01:23,407
You'll learn about static API routes and dynamic API routes,
29
00:01:24,540 --> 00:01:28,090
and how you can structure your files and folders here.
30
00:01:28,090 --> 00:01:30,910
And with that, you got another important tool
31
00:01:30,910 --> 00:01:33,730
in your toolbox, which allows you to
32
00:01:33,730 --> 00:01:36,490
really build any kind of project
33
00:01:36,490 --> 00:01:38,831
and any kind of website you want
34
00:01:38,831 --> 00:01:42,793
because Next.js has all the features you need for that.
2660
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.