1
00:00:00,330 --> 00:00:05,190
All right, and as always, we'll start with the setup and essentially we're looking forward to folder

2
00:00:05,190 --> 00:00:10,160
number six of the Jobs API and then more specifically, we have two more directories.

3
00:00:10,170 --> 00:00:12,660
We have the final one as well as the star.

4
00:00:12,840 --> 00:00:15,630
And of course, we'll do all of our work in a star.

5
00:00:16,050 --> 00:00:19,030
And then final is for your reference.

6
00:00:19,140 --> 00:00:20,830
So this is the complete project.

7
00:00:21,330 --> 00:00:25,590
Now, at this point, you should be able to already spin up the final project.

8
00:00:25,830 --> 00:00:32,430
If you want to just look for read me and then you'll find the info where, of course, we do need to

9
00:00:32,430 --> 00:00:41,250
create a data entry file in the road and set up two variables of the Mongo Yahiye as well as JWT Square

10
00:00:41,250 --> 00:00:41,460
one.

11
00:00:41,730 --> 00:00:45,810
And of course, this is going to be the connection, certainly among all your eye, what you're getting

12
00:00:45,810 --> 00:00:51,660
from Mongo DB, you just need to set up the proper password as well as database you want to use.

13
00:00:51,960 --> 00:00:57,720
And as far as the JWT Seagren won for the time being, you can set up some kind of silly value like

14
00:00:57,720 --> 00:01:04,530
we did in a previous project, because of course, in the Jobs one, I'll show you where to get a proper

15
00:01:04,650 --> 00:01:11,820
JWT secret value and after that, just run, npm install and ampm start.

16
00:01:12,120 --> 00:01:15,400
And the final project should be good to go.

17
00:01:15,750 --> 00:01:21,450
Now, as far as the starter, of course we'll just navigate here to the folder and the first thing that

18
00:01:21,450 --> 00:01:24,690
I want to do is go with KDDI and then drag and drop the.

19
00:01:25,470 --> 00:01:31,690
So now of course I'm here and before we do anything let's just go npm install and rpm start.

20
00:01:31,890 --> 00:01:36,510
So that should install dependencies and open up to their server.

21
00:01:36,840 --> 00:01:42,660
And as far as the set up in this case, we're going to have two controllers, one for authentication

22
00:01:43,020 --> 00:01:44,700
and the second one for the jobs.

23
00:01:45,090 --> 00:01:50,250
And of course again we have DB one where we're connecting through a database that should be already

24
00:01:50,250 --> 00:01:50,720
familiar.

25
00:01:51,090 --> 00:01:54,630
Then we have errors folder with all our classes.

26
00:01:54,870 --> 00:01:59,760
So we start with our custom API one and then we have one for about request.

27
00:01:59,760 --> 00:02:06,360
We have, of course, one for not found on authenticated, as was in the past, where we essentially

28
00:02:06,690 --> 00:02:11,990
pull in all the classes and then we can start using them around the project.

29
00:02:12,000 --> 00:02:18,150
And of course, since we have enlargers, we simply need to reference the errors folder and that will

30
00:02:18,150 --> 00:02:19,980
be the default export.

31
00:02:20,280 --> 00:02:24,570
And then we have another one where we've got a authentication one.

32
00:02:24,870 --> 00:02:30,060
So essentially this is going to be exactly the same like we did in the previous project or this one.

33
00:02:30,060 --> 00:02:33,390
I want to retype from the scratch because we only did it once.

34
00:02:33,390 --> 00:02:38,090
And then probably in the upcoming project we will reuse this one as well.

35
00:02:38,550 --> 00:02:40,580
And then, of course, we have our handler one.

36
00:02:41,400 --> 00:02:46,260
So this is where I got the custom API one, and then I'm just checking if that is the case.

37
00:02:46,260 --> 00:02:53,220
If that's our custom API, then of course we send the response with the status code as well as the error

38
00:02:53,220 --> 00:02:53,640
message.

39
00:02:54,000 --> 00:02:59,880
And of course I'm using the Status Codes Library and I prefer using this package because in my opinion,

40
00:03:00,210 --> 00:03:08,190
it adds a bit more consistency to our application as well as it's easier to understand what's happening

41
00:03:08,350 --> 00:03:09,900
with a status code.

42
00:03:10,140 --> 00:03:15,960
Of course, in this case, we have internal server error and also during this project, we'll do more

43
00:03:15,960 --> 00:03:22,650
work here in the Handler one, because I want to show you how we can check for multiple Mongo's errors

44
00:03:23,040 --> 00:03:29,520
instead of sending back always this five hundred one with the long error message, then of course we

45
00:03:29,520 --> 00:03:30,260
have not found.

46
00:03:30,510 --> 00:03:35,670
So if the user is looking for the router, doesn't exist because we send back four or four and then

47
00:03:35,700 --> 00:03:37,680
Orale does not exist after that.

48
00:03:37,680 --> 00:03:41,100
We have two models, so we'll have a job and user.

49
00:03:41,430 --> 00:03:46,230
And also the same goes for LB's will have the auth as well as the job.

50
00:03:46,770 --> 00:03:51,720
And then eventually we come through abcess, where again, we have two packages that we have used quite

51
00:03:51,720 --> 00:03:55,800
extensively, data entry, as well as the express async errors.

52
00:03:56,040 --> 00:04:00,120
I don't think I need to repeat what they're doing when we're looking for Express.

53
00:04:00,360 --> 00:04:04,020
And of course, we invoke it and we set it equal to the app.

54
00:04:04,290 --> 00:04:05,610
We have to middleware.

55
00:04:05,820 --> 00:04:08,670
We have not found one as well as the error handler.

56
00:04:08,670 --> 00:04:16,350
One line, of course, we invoke Dodgson because there's going to be some PoshTots and we want to access

57
00:04:16,390 --> 00:04:24,210
data in that body because there's a simpler route that get just a forward slash of this, of course,

58
00:04:24,420 --> 00:04:29,850
is going to be to our homepage just so we can test out whether that's the postman or the browser.

59
00:04:30,180 --> 00:04:36,720
And of course, I pass in the not found one as well as the Hourihan little one in about eight years.

60
00:04:37,170 --> 00:04:39,020
And of course, I set up the board.

61
00:04:39,330 --> 00:04:41,010
In this case, I'm going to go with three thousand.

62
00:04:41,010 --> 00:04:44,040
I believe the final one is five thousand.

63
00:04:44,280 --> 00:04:46,530
And then we have a start function.

64
00:04:47,500 --> 00:04:55,300
Where we just invoke that lesson and eventually, of course, we'll hear more code and if you can see

65
00:04:55,300 --> 00:05:02,380
clearly and console servers listening on PT. three thousand and if you navigate here the browser and

66
00:05:02,380 --> 00:05:06,040
go for localhost three thousand, you can see the jobs API.

67
00:05:06,430 --> 00:05:10,960
But of course we are in good shape and we can start setting up our application.

