1 00:00:01,030 --> 00:00:05,210 In this video we're going to do a little bit of basic setup of the expiration service. 2 00:00:05,260 --> 00:00:09,790 They're going to create a new sub project directory install some dependencies all that kind of low level 3 00:00:09,790 --> 00:00:10,340 stuff. 4 00:00:10,390 --> 00:00:13,530 Let's get to it right away back inside of my editor. 5 00:00:13,540 --> 00:00:17,740 I'm going to create a new directory called expiration now. 6 00:00:17,750 --> 00:00:23,930 I would love to add in a ton of stuff for the base project from scratch but just to save time in the 7 00:00:23,930 --> 00:00:28,250 context of this course we're going to instead copy over a couple of different files from our ticket 8 00:00:28,250 --> 00:00:32,650 service just to save some time inside of my tickets directory. 9 00:00:32,680 --> 00:00:40,090 I'm going to do a multi select of Docker ignore the docker file package Jason and the T S config Jason 10 00:00:40,090 --> 00:00:48,000 File as well once I've got all four files I'm then going to copy all them and then paste them into the 11 00:00:48,000 --> 00:00:56,110 expiration directory that we just created inside of expiration and then also going to create a s our 12 00:00:56,110 --> 00:01:03,440 C directory and we'll copy over one or two things from the SLC folder inside of tickets inside of the 13 00:01:03,500 --> 00:01:04,280 ticket service. 14 00:01:04,280 --> 00:01:10,860 I'll find the s RC directory and once again we will do a multi select this time of Nat's wrapper index 15 00:01:10,870 --> 00:01:13,640 T S and the MOX directory. 16 00:01:13,640 --> 00:01:20,780 So three things and total I'm going to copy those three things then paste them into the expiration services 17 00:01:20,860 --> 00:01:27,750 S.R. C directory that we just created so at this point you should have an identical directory structure 18 00:01:27,810 --> 00:01:32,040 please double check it just make sure you've got everything identical to what I show Inside the expiration 19 00:01:32,040 --> 00:01:34,170 service. 20 00:01:34,370 --> 00:01:38,420 Once you've got that all setup we're then going to go through a couple of these different files and 21 00:01:38,420 --> 00:01:43,280 just clean them up get them ready for the expiration service instead of the very particular setup they 22 00:01:43,280 --> 00:01:44,770 have for the ticket service. 23 00:01:45,530 --> 00:01:48,270 Well first begin with the package JS on file. 24 00:01:48,350 --> 00:01:52,910 We're gonna go through here and remove a couple of different dependencies and add one or two as well. 25 00:01:55,200 --> 00:02:00,570 Inside of the package it's on file inside the expiration service will update the name right here to 26 00:02:00,600 --> 00:02:05,740 expiration not actually required but might as well do it while we're here. 27 00:02:05,770 --> 00:02:08,900 Well then go and take a look at our dependency list. 28 00:02:09,030 --> 00:02:14,490 We've got a lot of dependencies inside of your related to handling network requests or HDTV requests 29 00:02:14,850 --> 00:02:19,050 specifically everything around express tokens and sessions. 30 00:02:19,050 --> 00:02:20,370 Cookie is all that stuff. 31 00:02:20,370 --> 00:02:23,380 We do not need any of that stuff with the expiration service. 32 00:02:23,760 --> 00:02:26,580 So we're going to remove a lot of these different dependencies. 33 00:02:26,580 --> 00:02:33,270 I'm going to highlight everything from types cookies session right here all the way down to Mongoose 34 00:02:33,360 --> 00:02:39,050 update if current and I'm going to delete all those dependencies. 35 00:02:39,140 --> 00:02:44,480 Now we are left with just for just the four you see right here. 36 00:02:44,600 --> 00:02:52,350 Next up inside the deb dependency section I'm going to delete hypes Super Test I will delete Mongo DV 37 00:02:52,410 --> 00:02:56,190 memory server and I will delete super test as well. 38 00:02:56,930 --> 00:02:58,670 There left with just these three. 39 00:02:58,670 --> 00:03:02,130 Nothing else okay. 40 00:03:02,160 --> 00:03:04,840 Looks good I'm going to save this file. 41 00:03:04,870 --> 00:03:09,100 Well then go back over to our terminal and we're going to install these dependencies and add in one 42 00:03:09,100 --> 00:03:10,000 or two others. 43 00:03:11,360 --> 00:03:12,570 So back at my terminal. 44 00:03:12,780 --> 00:03:15,500 I've already changed in to my new expiration directory. 45 00:03:15,570 --> 00:03:18,100 So make sure you change into expiration as well. 46 00:03:18,920 --> 00:03:23,380 Then once inside there we're going to install two packages. 47 00:03:23,780 --> 00:03:24,800 One is bold. 48 00:03:24,800 --> 00:03:29,730 So that is the job processing manager that we're going to use. 49 00:03:29,770 --> 00:03:33,040 We're also going to get the type definition file rebel as well. 50 00:03:33,070 --> 00:03:37,100 So that's at types slash all. 51 00:03:37,210 --> 00:03:43,050 I'm gonna run that and when we run npm install for these two packages those are the only packages that 52 00:03:43,050 --> 00:03:44,020 get installed. 53 00:03:44,040 --> 00:03:48,570 We then have to run a normal npm install to make sure that everything else we list inside of our package 54 00:03:48,600 --> 00:03:51,370 Jason File gets added in as well. 55 00:03:51,420 --> 00:03:58,120 So after that first command completes I'll then do a normal npm install all right. 56 00:03:58,120 --> 00:04:00,550 That's going to take a month or two solid just like it does thing. 57 00:04:00,550 --> 00:04:07,370 And I'm going to put back over where we will keep doing just a little bit of additional setup. 58 00:04:07,460 --> 00:04:11,420 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 59 00:04:11,420 --> 00:04:14,690 of stuff inside of here that is not going to be used inside of our expiration service. 60 00:04:15,930 --> 00:04:17,190 So inside of index yes. 61 00:04:17,220 --> 00:04:19,260 Again inside the expiration service. 62 00:04:19,530 --> 00:04:21,730 I'm going to delete the import for mongoose. 63 00:04:21,810 --> 00:04:32,310 I'll delete the import for app and I'll delete the two imports for these two listeners. 64 00:04:32,370 --> 00:04:37,490 Well then start to clean up these two first environment variable checks so we don't need a Jason with 65 00:04:37,490 --> 00:04:39,540 token key or a mango you or I. 66 00:04:39,890 --> 00:04:44,920 But we will leave around the next three then going down a little bit. 67 00:04:45,080 --> 00:04:47,550 We still need all this stuff around that's wrapper. 68 00:04:47,660 --> 00:04:53,040 The Nats wrapper client close and the process stuff right there as well. 69 00:04:54,260 --> 00:05:02,000 But then after that we're going to delete the two listeners we'll delete the Mongoose connect statement 70 00:05:02,150 --> 00:05:08,180 and the console log that says connected to mongo DB and then finally it will we will delete the app. 71 00:05:08,180 --> 00:05:16,230 Listen call at the very bottom and that's it. 72 00:05:16,420 --> 00:05:21,590 I'll save this file and close it to other files I want to check really quickly. 73 00:05:21,650 --> 00:05:23,680 So if we take a look at Nats wrapper. 74 00:05:23,680 --> 00:05:26,470 All right we just have some stuff inside of here around that mark. 75 00:05:26,560 --> 00:05:32,420 Not that we really need to fix up right now and then inside of the Nats wrapper TSA file we do have 76 00:05:32,420 --> 00:05:35,270 an import for node not streaming that's fine. 77 00:05:35,270 --> 00:05:39,910 We're seeing a couple of errors here around typescript you may or may not see these errors at all. 78 00:05:40,010 --> 00:05:41,930 If you do see these errors like I do. 79 00:05:41,930 --> 00:05:50,400 The way to fix them is once again command ship p on your keyboard and search for reload window alternately 80 00:05:50,430 --> 00:05:56,500 you could just restart your ED All right that looks a lot better for me. 81 00:05:56,600 --> 00:05:58,760 OK so that's pretty much it with some initial setup. 82 00:05:58,830 --> 00:06:00,670 We're going to take a pause right here when we come back. 83 00:06:00,670 --> 00:06:05,890 Next video we're going to build an initial Docker image but this expiration service will then create 84 00:06:05,890 --> 00:06:10,510 a couple of different Cuban settings config files to create a new deployment for our expiration service 85 00:06:10,720 --> 00:06:12,850 and also create that reddest instance as well.