1
00:00:00,330 --> 00:00:05,970
And as far as the setup, again, we've got to Folder's final, where you'll find the complete code

2
00:00:06,360 --> 00:00:08,700
and Ostara, where we'll do all of our work.

3
00:00:09,300 --> 00:00:16,770
And when it comes to final, you'll be able to spin it up once we cover JWT or JSON Web tokens, basically,

4
00:00:17,190 --> 00:00:20,720
since you'll need to set up a variable in data entry.

5
00:00:21,000 --> 00:00:24,570
And when it comes to Star, all of it should look very familiar.

6
00:00:25,230 --> 00:00:30,690
Like I promised in a previous studio, in order to save some time on a boilerplate, I already set up

7
00:00:30,690 --> 00:00:33,160
a basic Xpress server for you.

8
00:00:33,690 --> 00:00:38,450
So let me install dependencies and then I'll show you our objectives.

9
00:00:38,910 --> 00:00:39,990
So let me isomalt.

10
00:00:41,060 --> 00:00:46,490
I'll open up my terminal, I'll clear everything, and then, of course, first I want to navigate the

11
00:00:46,490 --> 00:00:47,060
star one.

12
00:00:47,720 --> 00:00:52,730
So grab it over here and then we're going to go with NPM install.

13
00:00:53,120 --> 00:00:56,780
And then, of course, we'll also spin up and be stuck.

14
00:00:57,380 --> 00:01:05,209
Now, when it comes to packaging, of course, there are few other packages as well, and I'll talk

15
00:01:05,209 --> 00:01:09,670
about them once we get there and when it comes to abcess.

16
00:01:10,040 --> 00:01:16,790
So first I require data entry and of course that is in order to access the variables.

17
00:01:17,120 --> 00:01:19,480
Then we have expressed interest in cars.

18
00:01:19,730 --> 00:01:24,830
And if you remember, we use that package just so we don't have to set up our own async middleware.

19
00:01:25,160 --> 00:01:31,760
When we grab the Express from Express and we invoke it and we're set equal to AB, then we're looking

20
00:01:31,760 --> 00:01:36,080
for two middle letters not found one and our handler one.

21
00:01:36,350 --> 00:01:41,090
And if you take a look at the folder, the middleware one, of course you'll see the error handler.

22
00:01:41,570 --> 00:01:45,200
This is the one that we use all the way in the project.

23
00:01:45,230 --> 00:01:50,350
Number three, this is essentially what we set up where we have the custom API error.

24
00:01:50,750 --> 00:01:52,940
And of course, we're looking for that instance.

25
00:01:52,940 --> 00:01:55,910
And then if that is the case, then this is the response.

26
00:01:55,910 --> 00:02:00,040
If not, then we just send back the five hundred one, the generic one.

27
00:02:00,410 --> 00:02:06,820
And of course, since we're using our own our class, of course, we also have it in the errors.

28
00:02:07,130 --> 00:02:11,780
So if you take a look at the customer, one, of course, you can see that we have the class that is

29
00:02:12,050 --> 00:02:13,910
extending from there.

30
00:02:14,180 --> 00:02:19,370
And we'll do that because, of course, they're going to be some instances where we'll implement our

31
00:02:19,370 --> 00:02:25,580
own class instead and of course, importing both of them from the middleware, like I said.

32
00:02:25,910 --> 00:02:29,300
And you can find the other one being not found here as well.

33
00:02:29,600 --> 00:02:33,400
And then we'll also work on the authentication middleware.

34
00:02:33,740 --> 00:02:36,200
That's what we find here, the empty file.

35
00:02:36,650 --> 00:02:40,760
Then we keep on moving and we can see that we have about eight years.

36
00:02:41,060 --> 00:02:42,910
So we implement the middleware.

37
00:02:43,130 --> 00:02:45,720
And in this case, I'm looking for a static one.

38
00:02:45,950 --> 00:02:53,380
So essentially we're serving static files because this is where our front end lives now.

39
00:02:53,450 --> 00:02:59,600
So here again, we have indexed the normal tile systems as well as the browser abcess.

40
00:02:59,930 --> 00:03:02,630
And then of course, we have expressed JSON.

41
00:03:02,840 --> 00:03:09,350
And that is simply because one of the routes is going to be a poster child and I want to access request

42
00:03:09,350 --> 00:03:09,970
that body.

43
00:03:10,370 --> 00:03:13,340
So I want to get that data that's going to be coming in.

44
00:03:13,610 --> 00:03:19,040
And then, of course, we implement both middleware as the not found one as well as our handler one.

45
00:03:19,250 --> 00:03:25,820
And then we have the port variable referred equal to process, not the end report or three thousand.

46
00:03:26,180 --> 00:03:28,520
And of course, in the final one it's a little bit different.

47
00:03:28,520 --> 00:03:34,730
I believe it's five thousand just so we don't have the port issues, meaning just that we don't have

48
00:03:34,730 --> 00:03:36,650
two apps trying to access the import.

49
00:03:37,010 --> 00:03:38,300
And then of course I have a start.

50
00:03:38,300 --> 00:03:43,190
One, however, you'll notice that in this case we are not connecting to the database.

51
00:03:43,490 --> 00:03:48,470
So I simply wanted to showcase how everything is going to work without database.

52
00:03:49,010 --> 00:03:55,640
And of course, the next project will implement the database because of course, that will add an extra

53
00:03:55,640 --> 00:03:57,470
layer of complexity.

54
00:03:57,650 --> 00:04:02,150
And of course, in here I just call about, listen, set up the port, set up to cancel login.

55
00:04:02,150 --> 00:04:04,130
If there is an error, I log on.

56
00:04:04,430 --> 00:04:10,490
Now, if you're wondering why I kept this DB folder with Connect one, just so you don't forget the

57
00:04:10,490 --> 00:04:12,530
setup again in the next project.

58
00:04:12,530 --> 00:04:19,339
Of course, a major part of the application is going to be setting up everything on the database.

59
00:04:19,670 --> 00:04:24,410
In this case, I just wanted to showcase how everything is going to work in isolation.

60
00:04:24,770 --> 00:04:30,710
And if you can say server servers listening on Portlaoise thousand, you can bravely navigate to your

61
00:04:30,710 --> 00:04:34,520
browser and we're looking for localhost three thousand.

62
00:04:34,880 --> 00:04:37,220
And of course you'll see the app now.

63
00:04:37,250 --> 00:04:41,060
Nothing is going to work, I can guarantee you that, because of course, we have no route.

64
00:04:41,420 --> 00:04:47,570
But you should see the UI, so you should see the form as well as this gibberish here in the bottom.

65
00:04:47,900 --> 00:04:53,390
And if you do and of course we're in good shape and now we can start working on the project.

