- [Instructor] We are not completely done yet,
the speaker's class and overall the conference-app
could need some cleanup to reflect what we just did.
So first of all, in Speakers.js on line six,
let's remove this readFile that we don't utilize anymore
and then we can remove fs and util.
And on the constructor, we see that we still passing
the data file that we don't use anymore.
Let's fix that now.
So we will get rid of the data file and this data file.
In the data directory, we now of course
can also remove the Speakers.Json
and in config Index.js,
we will remove also this config entries.
Instead we could now introduce some new config variables
and this could be the serviceRegistryUrl,
because it makes sense to not hard decode that.
So every time I see something hard coded,
like in URL in a class file,
this looks somehow suspicious.
So I configure that now, here.
And also, if you remember, we requested
before version one of the speaker service
when we did the call to the serviceRegistry
and let's make this more dynamic as well.
So I add serviceVersionIdentifier .
And this should be 1.x.x.
So we accept everything that is somehow version one.
Let's copy that over also
to the production environment settings.
Now let's change the constructor.
And there I will now also use object function parameters.
And I want to get here to serviceRegistryUrl
and the serviceVersionIdentifier.
And of course, I have to have to now
stored it as members to this class.
And now we have to use that as well.
So I'm heading down to get service.
And there, I now change the URL
to this.serviceRegistryUrl.
And we also want to change the version selector one
in the end to serviceVersionIdentifier.
So far, so good.
Now I'm heading into Index.js
because there we instantiate the speaker service.
And up here, I know just passing the config object,
because as you saw, in speakers,
we're using the structuring assignment on the constructor,
which will give us exactly the right properties
from our configuration file.
So let's run this with npm start.
And let's reload the app real quick.
And we see that everything is still okay.