In this video we're going to do a little bit of basic setup of the expiration service.
They're going to create a new sub project directory install some dependencies all that kind of low level
stuff.
Let's get to it right away back inside of my editor.
I'm going to create a new directory called expiration now.
I would love to add in a ton of stuff for the base project from scratch but just to save time in the
context of this course we're going to instead copy over a couple of different files from our ticket
service just to save some time inside of my tickets directory.
I'm going to do a multi select of Docker ignore the docker file package Jason and the T S config Jason
File as well once I've got all four files I'm then going to copy all them and then paste them into the
expiration directory that we just created inside of expiration and then also going to create a s our
C directory and we'll copy over one or two things from the SLC folder inside of tickets inside of the
ticket service.
I'll find the s RC directory and once again we will do a multi select this time of Nat's wrapper index
T S and the MOX directory.
So three things and total I'm going to copy those three things then paste them into the expiration services
S.R. C directory that we just created so at this point you should have an identical directory structure
please double check it just make sure you've got everything identical to what I show Inside the expiration
service.
Once you've got that all setup we're then going to go through a couple of these different files and
just clean them up get them ready for the expiration service instead of the very particular setup they
have for the ticket service.
Well first begin with the package JS on file.
We're gonna go through here and remove a couple of different dependencies and add one or two as well.
Inside of the package it's on file inside the expiration service will update the name right here to
expiration not actually required but might as well do it while we're here.
Well then go and take a look at our dependency list.
We've got a lot of dependencies inside of your related to handling network requests or HDTV requests
specifically everything around express tokens and sessions.
Cookie is all that stuff.
We do not need any of that stuff with the expiration service.
So we're going to remove a lot of these different dependencies.
I'm going to highlight everything from types cookies session right here all the way down to Mongoose
update if current and I'm going to delete all those dependencies.
Now we are left with just for just the four you see right here.
Next up inside the deb dependency section I'm going to delete hypes Super Test I will delete Mongo DV
memory server and I will delete super test as well.
There left with just these three.
Nothing else okay.
Looks good I'm going to save this file.
Well then go back over to our terminal and we're going to install these dependencies and add in one
or two others.
So back at my terminal.
I've already changed in to my new expiration directory.
So make sure you change into expiration as well.
Then once inside there we're going to install two packages.
One is bold.
So that is the job processing manager that we're going to use.
We're also going to get the type definition file rebel as well.
So that's at types slash all.
I'm gonna run that and when we run npm install for these two packages those are the only packages that
get installed.
We then have to run a normal npm install to make sure that everything else we list inside of our package
Jason File gets added in as well.
So after that first command completes I'll then do a normal npm install all right.
That's going to take a month or two solid just like it does thing.
And I'm going to put back over where we will keep doing just a little bit of additional setup.
So next year we're gonna do is take a look at our index not TSA file and we're gonna clean up a lot
of stuff inside of here that is not going to be used inside of our expiration service.
So inside of index yes.
Again inside the expiration service.
I'm going to delete the import for mongoose.
I'll delete the import for app and I'll delete the two imports for these two listeners.
Well then start to clean up these two first environment variable checks so we don't need a Jason with
token key or a mango you or I.
But we will leave around the next three then going down a little bit.
We still need all this stuff around that's wrapper.
The Nats wrapper client close and the process stuff right there as well.
But then after that we're going to delete the two listeners we'll delete the Mongoose connect statement
and the console log that says connected to mongo DB and then finally it will we will delete the app.
Listen call at the very bottom and that's it.
I'll save this file and close it to other files I want to check really quickly.
So if we take a look at Nats wrapper.
All right we just have some stuff inside of here around that mark.
Not that we really need to fix up right now and then inside of the Nats wrapper TSA file we do have
an import for node not streaming that's fine.
We're seeing a couple of errors here around typescript you may or may not see these errors at all.
If you do see these errors like I do.
The way to fix them is once again command ship p on your keyboard and search for reload window alternately
you could just restart your ED All right that looks a lot better for me.
OK so that's pretty much it with some initial setup.
We're going to take a pause right here when we come back.
Next video we're going to build an initial Docker image but this expiration service will then create
a couple of different Cuban settings config files to create a new deployment for our expiration service
and also create that reddest instance as well.