Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
So what is routing about?
Attached you find another starting project,
which when you start the server
gives you this simple application on the screen.
This is a view app
where we have two main areas,
Teams and Users,
we can switch between them
and for every team,
we can also click View Members,
though at the moment,
nothing happens when we do that.
So that's a very simple starting application
and if we have a look at this application,
it looks like if we had two pages here, right,
two links here in the navigation,
the teams and the users link.
But what you will notice is
that when I click those links,
what we see on the screen changes,
but the URL does not change.
It's always the same URL.
And that's in the end
what routing will be about.
With View we build
JavaScript driven client side web applications.
So web applications
where what the user sees,
is entirely controlled
by JavaScript running in the browser.
That is what a View is all about.
And we're also basically building a
so called single page application,
which means we have that
one single HTML file,
which is being fetched,
and that file includes imports to the,
to the scripts to all the JavaScript code
we're writing here in the end,
not to the code we are writing here,
but to a slightly transformed
and optimized version of that code.
And the CLI is taking care of all of that
behind the scenes.
But in the end it's all that JavaScript code,
which runs in the browser,
which is responsible for what we see
on the screen here.
And that's why we call this kind of app
a single page application.
So we want to have just
one HTML file
and then our JavaScript code controlling what we see
on the screen.
But with this approach,
we have one problem,
we have the same URL
for all areas
of our page.
And that means if I would want to share
this user's page
with another user,
well I could just share this regular URL,
which in this case is just our domain name,
and then nothing.
And if you enter this
and hit Enter,
you always end up on the starting page.
So I can't share anything else
than the starting page off this application.
Because the change that happens when I click this button
is driven by JavaScript
and has nothing to do with the URL.
It just happens up on the button, click here.
And whilst this works,
and this application works,
in reality, you would want applications
powered by you
and powered by that client's JavaScript code,
which still interact with the URL
so that the URL represents
where on the page we are
and so did we got a shareable URL,
which we can share with our users,
so that I could share
a link to this Users page
with our users
of this web application.
And of course we could try to make this work
by having more than one HTML file,
and then pointing at a different HTML file here,
like users HTML.
But that's not how this will work.
This is not how you build such view applications.
If you would do that,
the script code loaded
by that extra HTML file
would be totally unrelated
to your other script code,
which is probably also not what you want.
And that's the kind of problem routing
will solve for us.
Because it turns out
that there is a tool
an extra package
which we can install,
which allows us to handle URL changes
with JavaScript in the browser,
and then load something different on the screen
in the same single page application
when that URL changes
or based on that URL.
And that same package
will also help us change the URL
when we navigate somewhere else in this application,
so that the URL reflects the place
where we are
in the app.
And that is what routing is all about
and why we might want it.
So let's now install that extra package
to get started with routing.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.