1
00:00:00,420 --> 00:00:05,520
So in this lesson, we're going to be setting up Jason's server and running it locally, so this gives

2
00:00:05,520 --> 00:00:12,780
us an opportunity to run our own Jason database locally and also interact with it with the various methods

3
00:00:12,900 --> 00:00:17,530
to access the resources, modify the resources, get content from the endpoint.

4
00:00:17,760 --> 00:00:20,820
So this is going to be simulating an endpoint on the server.

5
00:00:21,000 --> 00:00:26,460
And typically, if we do have the data within a database, the server, the backend code is going to

6
00:00:26,460 --> 00:00:33,480
get that content from the database server and output it with an adjacent format and then with the JSON

7
00:00:33,480 --> 00:00:39,540
format, which is being simulated here, we can connect to it from our front end code by making a request

8
00:00:39,540 --> 00:00:40,440
to the endpoint.

9
00:00:40,800 --> 00:00:42,600
So that's going to be coming up in the next lesson.

10
00:00:42,630 --> 00:00:49,920
This lesson is all about installing node, setting up the node package manager, installing the JSON

11
00:00:49,920 --> 00:00:56,160
server and then also running the Jackson server database so it can be ready for the next lesson when

12
00:00:56,160 --> 00:00:57,420
we interact with the content.

13
00:01:00,890 --> 00:01:06,320
For the upcoming lessons, you are going to have to install node as we're going to be using a node package

14
00:01:06,530 --> 00:01:12,890
and running node as are back in code, connecting to it and simulating connection to the server and

15
00:01:12,890 --> 00:01:20,180
also to a database and database content node is available at Node J.S. dot org and then you can download

16
00:01:20,390 --> 00:01:23,710
the node version for your system.

17
00:01:23,960 --> 00:01:32,150
So they've got a version for Windows Mac and just the source code for Linux and also for the different

18
00:01:32,780 --> 00:01:33,710
bit versions.

19
00:01:34,580 --> 00:01:38,480
So this is the 32 bit and the 64 bit that can be downloaded for Windows.

20
00:01:38,960 --> 00:01:43,570
So once you download and install node, you're going to have node on your system.

21
00:01:44,060 --> 00:01:49,550
And in order to interact with node, this is going to be done with the terminal where we're going to

22
00:01:49,550 --> 00:01:53,720
be accessing the file system on the computer.

23
00:01:54,110 --> 00:02:02,300
And for a Mac, you can open up your terminal by pressing the command plus space and that will open

24
00:02:02,300 --> 00:02:03,200
up the spotlight.

25
00:02:03,470 --> 00:02:07,790
And then within the spotlight, you can search for terminal, open up the terminal and you're going

26
00:02:07,790 --> 00:02:10,850
to have to navigate to where your file directory is.

27
00:02:11,180 --> 00:02:15,020
I've created a separate folder I've just given in the name of node.

28
00:02:15,200 --> 00:02:20,920
And that folder is where I've got the indexed HTML file and the OP's JS file.

29
00:02:21,020 --> 00:02:26,090
You can list out the files within your directory with less on a Windows machine.

30
00:02:26,090 --> 00:02:27,410
It's Diar.

31
00:02:27,650 --> 00:02:32,240
So for directory to list out the folders that are currently within your directory.

32
00:02:33,720 --> 00:02:39,990
And the rest of the commands are going to be the same for Windows as well as for Max.

33
00:02:41,270 --> 00:02:45,620
And again, I am using a Mac for windows so you can open up the command.

34
00:02:46,840 --> 00:02:52,300
Terminal and there's also some additional terminals that can be downloaded, so there's open source

35
00:02:52,300 --> 00:02:57,040
terminals that you can install on windows in order to access your file system.

36
00:03:00,010 --> 00:03:07,000
So once you have node installed, you can check and make sure that you do have node by typing a node

37
00:03:07,010 --> 00:03:10,990
dashkova and you should get a version being returned back.

38
00:03:11,200 --> 00:03:17,050
So this is the current version that I have installed on my system to type in node DSV and that will

39
00:03:17,050 --> 00:03:17,770
install.

40
00:03:17,770 --> 00:03:19,480
And so, you know which version you have.

41
00:03:19,990 --> 00:03:22,710
Also, we are using node package manager.

42
00:03:23,110 --> 00:03:27,430
So this comes as part of node when you're installing it and downloading it.

43
00:03:27,970 --> 00:03:33,400
In case it didn't, you can go over to ENPI IMGs and install that separately.

44
00:03:33,670 --> 00:03:41,710
And in order to make sure that NPN is installed, you do NPM Dashkova and that will return back the

45
00:03:41,710 --> 00:03:46,260
node package manager version that you have installed on your system.

46
00:03:46,990 --> 00:03:52,750
So as long as you're getting versions being returned back for node and for package manager, you're

47
00:03:52,750 --> 00:03:57,520
going to be ready to move on to the next part where we're going to do the installation of the package.

48
00:03:57,880 --> 00:04:05,400
So the package that we're going to be installing is the Jackson server and it's available at NPM G.S.

49
00:04:05,410 --> 00:04:07,210
dot com for such a package.

50
00:04:07,390 --> 00:04:10,030
You can also search for the JSON server package.

51
00:04:10,660 --> 00:04:12,990
There's quite a lot of downloads for this package.

52
00:04:13,000 --> 00:04:14,440
That's fairly popular package.

53
00:04:14,740 --> 00:04:18,890
And you can literally set up your rest API in less than 30 seconds.

54
00:04:18,910 --> 00:04:20,860
There's really no coding involved.

55
00:04:20,860 --> 00:04:26,350
As long as you install node and you've got the node package manager ready, you can just do a install

56
00:04:26,350 --> 00:04:27,720
of your JSON server.

57
00:04:27,970 --> 00:04:37,990
So doing an NPN install G and the dash means that this is globally installed and they do have a sample

58
00:04:37,990 --> 00:04:46,300
of debug JSON file so you can create that DB JSON file in order to set up your database.

59
00:04:46,540 --> 00:04:52,840
I got to start out with defaulted JSON file and open up the editor and I'm going to just create this

60
00:04:52,840 --> 00:04:58,770
on the same folder directory that I've got, the indexed HTML and the OP's one JS file.

61
00:04:59,140 --> 00:05:07,580
So just create a new file, paste the data and then this needs to be saved as the debug Jason file.

62
00:05:09,670 --> 00:05:14,860
So go ahead and save that and then we're going to be accessing this with the code.

63
00:05:15,760 --> 00:05:24,370
And also I do have the terminal right now has navigated over to the same folder directory so I can list

64
00:05:24,370 --> 00:05:27,430
out URLs and there's my database file.

65
00:05:27,880 --> 00:05:37,690
So I'm ready to launch the node application and that can be done with Jason Server Watch and then selecting

66
00:05:37,690 --> 00:05:44,230
the file that we want to watch and then we can go to the endpoints for the localhost and get the requests

67
00:05:44,230 --> 00:05:44,590
from there.

68
00:05:45,970 --> 00:05:53,200
So going back into the terminal, we want to launch the deep thought JSON file with the adjacent server.

69
00:05:53,380 --> 00:05:58,180
And if you get this error message command not found, that means that JSON server is not installed.

70
00:05:58,600 --> 00:06:07,600
So you can select the NPM install and globally install the JSON server if you are not able to install

71
00:06:07,600 --> 00:06:12,940
it on a MAC to set the permissions to install as admin.

72
00:06:13,150 --> 00:06:20,500
You can use the pseudo NPM install Daichi JSON server, so that will allow you to do an install as the

73
00:06:20,500 --> 00:06:21,180
administrator.

74
00:06:21,610 --> 00:06:25,950
So if you do throw any security errors or any issues, then you can do that as well.

75
00:06:26,760 --> 00:06:30,520
So it just takes a few seconds and it should install fairly quickly.

76
00:06:31,970 --> 00:06:35,940
And these are the permissions issues that you might encounter.

77
00:06:36,110 --> 00:06:40,370
So this just means that your application doesn't have the right permissions.

78
00:06:40,730 --> 00:06:43,340
So addin UniMac, Adam Souto.

79
00:06:43,640 --> 00:06:49,850
And on a Windows machine, generally, it should run as the administrator as long as the terminal is

80
00:06:49,850 --> 00:06:51,560
being run within the administrator.

81
00:06:52,610 --> 00:06:56,370
So also pseudo NPR install and let's try that one more time.

82
00:06:57,290 --> 00:07:00,170
So it's going to be ask me for my system password.

83
00:07:00,170 --> 00:07:05,380
So type in the system password and now it's going to be installing it as an administrator.

84
00:07:05,720 --> 00:07:11,840
So that will be providing access to the computer file system to do the install.

85
00:07:12,410 --> 00:07:14,510
So now we've got the install done.

86
00:07:15,380 --> 00:07:23,510
I'll clear out the console content and now I should be able to do that JSON server and watch the database

87
00:07:23,510 --> 00:07:23,780
file.

88
00:07:24,750 --> 00:07:31,140
So once we have this up and running and once you've got the Jason server installed, now you can go

89
00:07:31,140 --> 00:07:34,710
to localhost and you can request to the posts.

90
00:07:35,220 --> 00:07:41,700
So also go ahead and try that out and just make sure that you are getting some type of response there.

91
00:07:42,240 --> 00:07:45,210
And if you update the database that Jason.

92
00:07:45,780 --> 00:07:51,390
So if we were to add more posts there and I do a toggle here of the JSON data.

93
00:07:55,200 --> 00:07:56,880
And comma, separate them.

94
00:07:59,640 --> 00:08:06,600
So I'll add in another post just to make sure that we do have the live data and save it, and now when

95
00:08:06,600 --> 00:08:13,920
I refresh it, there's my data that's coming in so I can use this now server as an endpoint to make

96
00:08:13,920 --> 00:08:14,670
connections.

97
00:08:15,060 --> 00:08:19,730
And also within the terminal, they listed out the other options that we have.

98
00:08:19,980 --> 00:08:24,480
So we have four comments and then we also have four profile.

99
00:08:26,800 --> 00:08:34,030
So all of these end points are also driven by what we have here within the main object, so they are

100
00:08:34,030 --> 00:08:36,190
the property names of the objects.

101
00:08:39,340 --> 00:08:48,700
So we can add in additional rights and additional JavaScript, JSON object as needed.

102
00:08:49,480 --> 00:08:54,010
So now when I checked the Roots, I've got a new route here for Testor.

103
00:08:54,610 --> 00:09:00,670
If I want to list out everything that's available there and if I want to select.

104
00:09:00,680 --> 00:09:07,720
So if I want to select the particular posts so I could go to posts and then using whatever the ID is,

105
00:09:08,080 --> 00:09:10,190
this can return back the post.

106
00:09:10,210 --> 00:09:14,540
So this would return back to the second post and this would return back to the first post.

107
00:09:15,430 --> 00:09:19,120
So also within comments, it's going to work the same way.

108
00:09:19,120 --> 00:09:22,540
If I want to return back the first comment, I can do comments.

109
00:09:22,540 --> 00:09:29,980
One, if I try to return back a comment that doesn't exist, I'm just going to get a blank Jason object

110
00:09:29,980 --> 00:09:30,820
being returned back.

111
00:09:33,400 --> 00:09:41,380
So once you have set this up and if you just go to the base, you, Earl, it's going to list out Jason

112
00:09:41,380 --> 00:09:42,620
server information.

113
00:09:43,720 --> 00:09:47,530
So this is just something to keep in mind that it's not listing out the index file.

114
00:09:47,710 --> 00:09:49,690
It's running the Jason server.

115
00:09:50,410 --> 00:09:54,040
And it does list out the resources that we have here.

116
00:09:54,250 --> 00:09:58,930
And we're also able to access it, get post put patched delete options.

117
00:10:01,290 --> 00:10:06,250
So we can modify the resources using any HTTP method.

118
00:10:07,860 --> 00:10:15,000
So going back into index, we're going to open this with live server, so our editor with Life Server

119
00:10:15,900 --> 00:10:20,410
and then make a fetch request to the new endpoints that we've just set up.

120
00:10:22,290 --> 00:10:23,910
So that's coming up in the next lesson.

121
00:10:24,100 --> 00:10:30,150
So this lesson was a set up lesson to set up your local Jason server, customize your database with

122
00:10:30,150 --> 00:10:30,950
some content.

123
00:10:31,170 --> 00:10:33,900
And then next coming up next, we're going to interact with that content.

124
00:10:36,280 --> 00:10:43,720
Thanks for this lesson and before the next lesson is to install node so good over to Node J.S. dot org

125
00:10:43,900 --> 00:10:48,850
and download the version, a node for your system, then open up your system terminal.

126
00:10:49,030 --> 00:10:52,570
So on a Windows machine, you can do the command and UniMac.

127
00:10:52,570 --> 00:10:56,410
You can open up within spotlight and do a search for terminal.

128
00:10:56,560 --> 00:10:59,290
So shortcuts open spotlight is command plus space.

129
00:10:59,680 --> 00:11:05,920
And once you open up the terminal, check to make sure that node is installed, also make sure that

130
00:11:05,920 --> 00:11:07,930
NPM version is installed.

131
00:11:08,110 --> 00:11:15,370
And you can do that by typing node space, Dash V and NPM Space Dashkova, and that will show you the

132
00:11:15,370 --> 00:11:17,170
versions of each one of those.

133
00:11:17,440 --> 00:11:26,770
Create DPE Dot Geass on file locally, add valid JSON data and set up your custom routes if needed.

134
00:11:27,040 --> 00:11:32,980
I would suggest to start with just whatever the default data is available on the server and on their

135
00:11:32,980 --> 00:11:37,120
website and try it out first just to make sure that you get it up and running.

136
00:11:37,450 --> 00:11:41,680
Install the Jason server on your system again using the terminal.

137
00:11:42,010 --> 00:11:49,670
So NPM install Dash G for the global flag and design server for the package that's being installed.

138
00:11:50,230 --> 00:11:56,590
Also, if you do encounter any permissions errors on a Mac, prefix it with the word pseudo and that

139
00:11:56,590 --> 00:11:59,620
will allow you to accept permissions and run with an admin.

140
00:12:00,070 --> 00:12:04,060
And then once you've set it up, run the JSON server package.

141
00:12:08,490 --> 00:12:17,580
And the command for that within the terminal is Jason Jassal and Dash Server see are VR space dash,

142
00:12:17,580 --> 00:12:19,950
dash, watch ATC.

143
00:12:20,760 --> 00:12:25,440
And then space, whatever the file name is, where you've got your JSON data.

144
00:12:25,560 --> 00:12:31,440
So in this case, we're using the default, which is DB, DOT, JSON and also open it up within your

145
00:12:31,440 --> 00:12:32,160
web browser.

146
00:12:32,340 --> 00:12:37,390
So go to localhost Colen three thousand four report three thousand.

147
00:12:37,710 --> 00:12:44,130
And check out the documentation that's available now within your local machine.

148
00:12:44,910 --> 00:12:50,580
And coming up next, you're ready to access those endpoints and then this is all going to be done locally.
