The last piece of code that we need to write for an application before compile need for production is
needed to provide an application.
The ability to manage wrong you address.
So for example in this case we know that we can create a new question by going on as Lesh asking.
But what if we just go to slash as as you see the pages no empty.
And that's because in their root there Dr. J.
Yes file.
There is no route specified to actually serve that specific path.
And so here below we can create one last route.
We've path.
And here we can add an asterisk and n is a name.
We can set.
Page not found and there's a component just to show our way.
But if it works we can add the home component.
So let's go back here and if we now try to navigate once again to these as path we are now redirected
you see to the home component.
Basically this was of course just an example.
Let's now create an appropriate component not found dot view.
And now we can imported Yeah.
A route that GSA.
So I'm just going to copy the code and just paste it.
Yeah.
So import not found from the view's not found don't view and we can pass it.
Yeah.
So let's now develop this component template and yet inside as always diva we can also add this USS
Glasser not found.
Let's add another diva glass container and a bit of margin
and yet we can now use an H to again to show what message we can do and define in this creep tag.
So a script name not found
data.
The third message for 0 4.
Page Not Found.
We can also idea an idea not found and added below.
Let's define a style tag and well actually let's remove this hyphen so that we can use the idea like
song color red text align center.
And so if you now go back here let's try to create a new question and let's change the umbrella once
again to assume.
Awesome we know good photo for Page Not Found.
Everything works as expected.
So as long as the U.S. red requested is not air defined as a path as a proper path in the route that
a Delta G.
Yes file viewer Luther Wheeler redirected the request to the not found component.
However this is not enough.
Let's try to open a question and let's try to use it wrong as luck.
Like so you see that this is the question component because we have posted by.
We have answered the question and if we expect the application here we see the 4 0 4 message not found
of course but in view dev tools we still have the question components you see.
So we need to change the way our application gets the data and also the way the age TTP requests are
handled.
So first of all let's go to common API set of these three.
Yes sir.
And yeah I see first of all that we don't need this a scene.
And we can change the name of a function to handle response
like so.
So if they start whose code is 2 0 4 we just want to return an empty string.
Else if a response dot status is for 0 4 not found in that case we want to return new low.
Otherwise we can just return response not Jason and you are like it is three equal signs like so.
However this is not in our film.
So let's go back to the question that you component specifically in there get question data method so
we can check if we actually get data.
So if data in that case everything should work as always so we could either push the user to these root
or even better.
We can set these that question to a new low and said these DOT said Page data also called that said
Page Title method to set the title of the page to photo for page not found and now appear in this deed
of class contain it we can add the veep if question.
So all the h the email code for the component as to be shown if we actually get a question otherwise
below we can define another diva V as endearing side we can define and each one are very similar to
the one defined yet.
Ah well actually almost the same each one had to we can simply add for 0 4.
Page not found or even better question.
Not found.
And just to optimize the component of it more the effect.
QUESTION.
SO LET'S GO BACK HERE AND LET'S MAKE ANOTHER Geth request using these same urinal and we get for a question
not found.
Very good.
Just to be precise this tiling of course is zero because we have not included code.
Yeah that we can actually add so we can simply define the same code here below.
Oh well in fact we have the error class.
So let's go back here.
So we can just add class header text Center going back here.
It's now even better.
Awesome.
Now we have a single page up is finally completed on the javascript code is being written.
It's finally time to learn how to compile the whole application for a production and we are going to
do so in the next lesson.