All language subtitles for 034 Challenge 16 Solution_en

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French Download
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,450 --> 00:00:02,120 All right so here comes the answer. 2 00:00:03,090 --> 00:00:08,880 Before you do anything I recommend reading through the docs and seeing how these parameters work. 3 00:00:08,940 --> 00:00:15,390 And remember that we're using the colon and then we're going to give our parameter a name so that we 4 00:00:15,390 --> 00:00:21,540 can tap into it later on using req.params. the name that we specified. 5 00:00:21,750 --> 00:00:27,030 So now we can head into our app.js and you can create that route any way you wish. 6 00:00:27,300 --> 00:00:29,930 I'm going to put it just before the end right down here 7 00:00:29,940 --> 00:00:36,510 just before my app.listen. And I'm going to say app.get and then I'm going to specify / 8 00:00:36,660 --> 00:00:44,250 posts/: and then here comes the name of my parameter which you can call anything you 9 00:00:44,250 --> 00:00:45,930 wish as long as it makes sense to you 10 00:00:46,080 --> 00:00:55,200 but I'll call it postName. And then I'll add my callback, my req and res and then inside my callback I 11 00:00:55,200 --> 00:00:59,070 am going to tap into that parameter called postName. 12 00:00:59,070 --> 00:01:09,360 So I want to console log it. So I'm going to log the req.params.postName. And it has 13 00:01:09,360 --> 00:01:13,450 to be spelt exactly the same as you see here after the colon. 14 00:01:13,590 --> 00:01:15,410 But there's no colons down here 15 00:01:15,420 --> 00:01:21,700 remember that. This is all that you need in order to tap into a dynamic 16 00:01:21,720 --> 00:01:22,890 URL right? 17 00:01:22,920 --> 00:01:28,890 Because we're using this parameter to decide what it is that we should do inside our app.get. 18 00:01:28,920 --> 00:01:36,360 So we can now say if they said I wanted you know the post that has a post name of testing then we will 19 00:01:36,540 --> 00:01:37,770 send them over there 20 00:01:37,830 --> 00:01:43,940 and if they wanted the post that had a name of ordinary I love pets then we will show them that page. 21 00:01:43,950 --> 00:01:48,450 So this is the first step towards getting a dynamic website created. 22 00:01:48,600 --> 00:01:53,570 And this is all down to using Node and Express, nothing else. 23 00:01:53,590 --> 00:02:01,060 Now we can test this and if we head over to posts/ anything you want to write afterwards then 24 00:02:01,060 --> 00:02:05,320 it will get logged down here in our console. 25 00:02:05,350 --> 00:02:11,080 So this is the first step towards achieving our dynamic website and feel free to mess around with it, 26 00:02:11,210 --> 00:02:17,080 try out different parameter names, try out multiple parameters as you can see where they've got 27 00:02:17,440 --> 00:02:21,420 this one which is a single parameter and this one which is another parameter 28 00:02:21,610 --> 00:02:26,780 and you can actually tap into both just by using req.params. the name of your parameter in your 29 00:02:26,780 --> 00:02:27,590 URL. 30 00:02:27,790 --> 00:02:31,450 So play around with that and once you're ready we'll head over to the next challenge. 3259

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.