All language subtitles for 018 Challenge 8 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
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

Original subtitles

All right.

So this was a slightly more difficult challenge

and let's see if you got it right.

Now inside our compose.ejs where we've got our input and our button, in order for us to be able

to pass the value inside our input over to our server where we can log it

we have to include this inside an HTML form so let's add that now. And our input in our button needs

to go inside the form. And we have to make sure that the button is of type submit so that when you click

it it actually submits the data that's inside the form to which ever action is specified here.

Now we need to change this to a route that we're going to handle and I'm going to call it /

compose.

So we handle a post request to the /compose route in our server.

Now the other thing you have to be careful about is your input has to have a name

and this is going to be like the variable name to allow us to tap into its value.

So I'm going to call this the postTitle because that's what we're going to use this input for a little

bit later on. If you called it

anything else that's completely fine as long as you know what it's called

and you know what it refers to then it won't be a problem.

So now that we're done with our compose.

ejs, we're going to have to go into our server and handle what should happen when the page is making

a post requests to the compose route.

Currently all we have is a get method for our compose route.

So our server knows what to do when somebody makes a get request to /compose namely when

they try to view it but the server doesn't yet know what to do when somebody makes a post request to

that route.

So we have to add our app.post method targeting the /compose method and then we add our anonymous

function req and res and then we open up a set of curly braces. Inside

here is where we'll be able to console log the value of the text that was entered into the input over

here.

Now just to remind ourselves, that input had a name of postTitle.

So I need to tap into that inside this route to be able to log it.

And in order to get hold of it I need to use the request.body and this comes from our body-parser

module up here.

So the usual way that we tap into the post request data is we say request.body. the name of the

input which I happened to call postTitle.

Now if we can log the post requests that was sent to /compose and we tap into the body

using body-parser and the value of the variable could postTitle

then once we run this page and refresh it then we should be up to type in some sort of text, hit publish

and head over to our console and see it printed in here.

So how did you get on with that challenge? If it was ok then go ahead and continue to the next challenge.

If it was really difficult or you needed to see all the hints try and review the relevant parts of the

EJS module

where we went through all of this in detail.

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