1
00:00:00,330 --> 00:00:06,030
No, I think we're done with our handling, at least for now and now let's talk about deployment.

2
00:00:06,720 --> 00:00:12,450
And right off the bat, I want to say that we're not going to deploy this project simply because we

3
00:00:12,450 --> 00:00:19,530
have not covered authentication yet, as well as extra packages for security and deploying.

4
00:00:19,530 --> 00:00:27,120
The project where anyone can tinker with all the data is somewhat irresponsible and actually can lead

5
00:00:27,120 --> 00:00:28,410
to a lot of headaches.

6
00:00:28,900 --> 00:00:35,370
But with that said, there is something deployment related I want to cover, and that is our port variable.

7
00:00:36,030 --> 00:00:42,060
You see hardcoded value like portaledge thousand or six thousand or seven thousand is a decent solution

8
00:00:42,060 --> 00:00:43,380
in our local environment.

9
00:00:43,590 --> 00:00:47,430
But when it comes to deployment in many environments, the host.

10
00:00:47,670 --> 00:00:54,120
So the platform where the project is posted on may want to independently set the value to whatever makes

11
00:00:54,120 --> 00:00:59,670
sense to the platform, because as you can imagine, it needs to handle more than just one application

12
00:00:59,670 --> 00:01:05,940
at the time and in order to make that possible when it comes to port value, instead of hard coding

13
00:01:05,940 --> 00:01:11,580
to three thousand, six thousand or whatever, we'll have to use the port variable that is available

14
00:01:11,730 --> 00:01:18,480
in process that envy instead and set up or operate just in case it's undefined.

15
00:01:18,900 --> 00:01:22,860
And not to set that up, we need to go to our port variable.

16
00:01:23,140 --> 00:01:30,450
That's why in this case we set it up as a variable and before the three thousand, we actually want

17
00:01:30,450 --> 00:01:37,350
to go with process and dot the enemy and then we're looking for the port variable.

18
00:01:37,650 --> 00:01:43,770
So we go here with port and then if it is set, then of course we'll use that value.

19
00:01:44,070 --> 00:01:50,000
If not one, we'll use the operator and then of course, we're going to go with three thousand.

20
00:01:50,010 --> 00:01:54,150
Now, of course, in a local environment, by default, it's not going to be said.

21
00:01:54,390 --> 00:02:01,380
So always go back to the three thousand or once we deploy, it's going to be a different scenario.

22
00:02:01,650 --> 00:02:05,520
Now, if you want to test that out in local environment, you can actually do so.

23
00:02:05,850 --> 00:02:13,200
And we do that by stopping the server and then we want to go with a port and we set it equal to whatever

24
00:02:13,470 --> 00:02:14,020
you want.

25
00:02:14,310 --> 00:02:18,380
Now, I'm I guess I'm not going to go with 5000 because I believe my final one is using that.

26
00:02:18,720 --> 00:02:20,490
So I'm going to go six thousand.

27
00:02:20,760 --> 00:02:24,720
And then you want to go with Node and then what is the name of the file you want to run?

28
00:02:24,990 --> 00:02:29,000
Of course it is Appoggiaturas and now check it out in a console.

29
00:02:29,010 --> 00:02:36,420
We should see 6000 now of course I still see three thousand because I didn't have to file my apologies.

30
00:02:36,440 --> 00:02:38,010
Let me stop the server.

31
00:02:38,400 --> 00:02:43,020
Just so you don't think that I'm messing with you and let me run the command one more time.

32
00:02:43,290 --> 00:02:50,850
And now of course in the console I can see server is listening on for six thousand and one more time.

33
00:02:50,850 --> 00:02:57,270
As far as our logic, would you say support to whatever is the environment variable by the name of port

34
00:02:57,720 --> 00:03:00,660
or thirty thousand if there's nothing there.

