All language subtitles for 012 Challenge 5 Solution_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
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
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French Download
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,240 --> 00:00:04,430 All right here comes the answer for challenge 5. 2 00:00:04,490 --> 00:00:12,200 Now as I mentioned, the first thing to address is our contact.ejs page and our about.ejs page. 3 00:00:12,200 --> 00:00:15,430 We essentially want to replicate what we did in our home. 4 00:00:15,680 --> 00:00:17,300 ejs. And for time's sake 5 00:00:17,330 --> 00:00:23,230 I'm just going to copy and paste what we had in our home.ejs into these two pages. 6 00:00:23,220 --> 00:00:30,350 Now in our contact.ejs we want to include the head partial and the footer partial but instead of 7 00:00:30,350 --> 00:00:36,920 having an h1 that says home, it should now say contact. And instead of passing in the starting content 8 00:00:37,220 --> 00:00:42,820 we're going to pass over the contact content as the name of the variable. 9 00:00:43,070 --> 00:00:45,790 And I'm going to do the same inside about page. 10 00:00:45,810 --> 00:00:51,490 So I'm going to change the h1 to about and the content to about content. 11 00:00:51,740 --> 00:00:57,410 So now let's hit save on both of those pages and we're ready to go into our app.js to define the 12 00:00:57,410 --> 00:00:58,370 routes. 13 00:00:58,370 --> 00:01:05,090 So we're going to again use app.get because the user is trying to get these web pages. And the first 14 00:01:05,090 --> 00:01:11,320 route we're going to target is /about and then we're going to add our callback function our req 15 00:01:11,350 --> 00:01:13,260 and res. 16 00:01:13,550 --> 00:01:16,890 And inside this function we're going to again res.render. 17 00:01:17,210 --> 00:01:23,180 But this time instead of rendering the home page we're going to render the about page. And then we're 18 00:01:23,180 --> 00:01:29,060 going to pass over a Javascript object that has to be named about content. 19 00:01:29,120 --> 00:01:34,860 So I'm just going to copy this over here and use it as the key inside this Javascript object. 20 00:01:35,120 --> 00:01:41,060 And I'm going to add my colon and I'm going to pass in the variable that I want to have inside my About 21 00:01:41,060 --> 00:01:44,320 page which is this thing about content. 22 00:01:44,540 --> 00:01:50,480 So I'm going to go ahead and add that there and then we'll close everything off with some semicolons 23 00:01:50,870 --> 00:01:53,980 and that should now get us are about page. 24 00:01:54,050 --> 00:02:01,130 Now notice how over here passing in this object I try to make it clear by saying that the variable name 25 00:02:01,160 --> 00:02:06,700 that's going to be passed over is called starting content and that is what we'll have access to 26 00:02:06,710 --> 00:02:13,820 now inside home.ejs once that gets passed over. And the data I'm passing over is called home starting 27 00:02:13,820 --> 00:02:15,650 content which comes over here. 28 00:02:15,890 --> 00:02:19,130 So that value is what's going to be passed over. 29 00:02:19,220 --> 00:02:24,980 Now inside this route, I'm keeping more in line with the Node and Express standard formatting which is 30 00:02:24,980 --> 00:02:29,530 where they use the same name for the key and the value. 31 00:02:29,750 --> 00:02:31,880 Now if you find this confusing 32 00:02:31,880 --> 00:02:37,850 feel free to do it exactly the same way that I've done it here just to make it clear what's the value, 33 00:02:37,880 --> 00:02:39,170 where's it from, 34 00:02:39,290 --> 00:02:42,560 and what's the key and what's being passed over. 35 00:02:42,980 --> 00:02:48,530 And depending on your comfort level, name your variables whichever way you wish. 36 00:02:48,530 --> 00:02:56,060 Now all we have to do is just add our last path which is an app.get method for the /contact 37 00:02:56,120 --> 00:02:56,920 page. 38 00:02:57,230 --> 00:03:06,940 And then here's our anonymous callback function. And we're going to res.render our contact page 39 00:03:07,850 --> 00:03:11,660 and we're going to pass over our contact content. 40 00:03:13,900 --> 00:03:20,950 And the value of that is going to be from this current page with a variable called contact content. 41 00:03:21,100 --> 00:03:29,620 And let's again close off with semicolons and now we should be able to test our code and refresh our 42 00:03:29,620 --> 00:03:30,550 page. 43 00:03:30,580 --> 00:03:36,700 And now if we go to /contact we can see that we're getting this data here which of course 44 00:03:36,790 --> 00:03:38,710 comes from this variable. 45 00:03:38,710 --> 00:03:45,880 So that means we've successfully passed over contact content over to our contact.ejs and we're including it 46 00:03:45,880 --> 00:03:47,850 inside a paragraph type. 47 00:03:48,250 --> 00:03:56,530 And if we head over to /about then we get the about content that we had over at the top of 48 00:03:56,530 --> 00:03:58,800 our app.js. 49 00:03:58,870 --> 00:04:05,490 So that was just a refresher on how we create our routes and how we pass data around using EJS. 50 00:04:05,710 --> 00:04:08,690 And we did this plenty of times in the EJS module. 51 00:04:08,710 --> 00:04:13,120 So if you're at all confused, be sure to take a look back at those videos. 52 00:04:13,480 --> 00:04:16,269 But once you're ready it's time for the next challenge. 5503

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