GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — add changes :cat2: · D-Mbithi/fullstack-javascript@551c9ac

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • chapter2
    • chapter2.md
  • chapter4
    • chapter4.md
  • chapter6
    • chapter6.md
  • chapter8
    • chapter8.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎chapter2/chapter2.md‎

Copy file name to clipboardExpand all lines: chapter2/chapter2.md
+41-103Lines changed: 41 additions & 103 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -146,193 +146,131 @@ Generating SSH keys and uploading them to SaaS/PaaS web sites will be covered la
146146
Local HTTP Servers
147147
==================
148148

149-
Although you can do most of the front-end development without a local
150-
HTTP server, it is needed for loading files with HTTP Requests/AJAX
151-
calls. Also, it's just good practice in general to use a local HTTP
152-
server. This way, your development environment is as close to the
153-
production environment as possible.
149+
Although you can do most of the front-end development without a local HTTP server, it is needed for loading files with HTTP Requests/AJAX calls. Also, it's just good practice in general to use a local HTTP server. This way, your development environment is as close to the production environment as possible.
154150

155-
I recommend you use Node-based tools as static web servers. They lack
156-
GUIs, but they are simple and fast. You can install them with npm (comes
157-
with Node.js; instructions are later in this chapter):
151+
I recommend you use Node-based tools as static web servers. They lack GUIs, but they are simple and fast. You can install them with npm (comes with Node.js; instructions are later in this chapter):
158152

159153
- [*node-static*](https://github.com/cloudhead/node-static) (<https://github.com/cloudhead/node-static>): Static file server with built-in caching. Run `npm i -g node-static` to install.
160154

161155
- [*http-server*](https://www.npmjs.com/package/http-server) (<https://www.npmjs.com/package/http-server>): Zero-configuration command-line HTTP server. Run `npm i -g htt-server` to install.
162156

163157
If you prefer something with GUIs to a command-line interface (CLI), you might want to consider the following modifications of the Apache web server. MAMP, MAMP Stack, and XAMPP have intuitive GUIs that allow you to change configurations and host file settings.
164158

165-
- [*MAMP*](<http://www.mamp.info/en/index.html>) (<http://www.mamp.info/en/index.html>): Mac, Apache, MySQL,
166-
PHP personal web server for macOS.
167-
- [*MAMP Stack*](http://bitnami.com/stack/mamp)
168-
(<http://bitnami.com/stack/mamp>): Mac app with PHP, Apache, MySQL,
169-
and phpMyAdmin stack build by BitNami (Apple App Store)
170-
(<https://itunes.apple.com/es/app/mamp-stack/id571310406?l=en>).
171-
172-
- [*XAMPP*](http://www.apachefriends.org/en/xampp.html)
173-
(<http://www.apachefriends.org/en/xampp.html>): Apache distribution
174-
containing MySQL, PHP and Perl for Windows, Mac, Linux, and Solaris.
159+
- [*XAMPP*](http://www.apachefriends.org) (<http://www.apachefriends.org>): Apache distribution containing MySQL, PHP and Perl for Windows, macOS, Linux, and Solaris.
160+
- [*MAMP*](<http://www.mamp.info>) (<http://www.mamp.info>): Apache, MySQL, and PHP personal web server for macOS.
161+
- [*MAMP Stack*](https://bitnami.com/stack/mamp) (<https://bitnami.com/stack/mamp>): Another Apache, MySQL, and PHP stack for macOS.
175162

176163
Database: MongoDB
177164
-----------------
178165

179-
The following steps are better suited for macOS/Linux-based systems,
180-
but with some modification they can be used for Windows systems as well
181-
(i.e., $PATH variable, Step 3). Here we describe the MongoDB
182-
installation from the official package, because we found that this
183-
approach is more robust and leads to less conflicts. However, there are
184-
many other ways to install it on Mac (<http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x>), for
185-
example using Brew, as well as on other systems (<http://docs.mongodb.org/manual/installation>).
186-
187-
1. MongoDB can be download ed at (<http://www.mongodb.org/downloads>).
188-
For the latest Apple laptops, like MacBook Air, select OS X
189-
64-bit version. The owners of older Macs shouldbrowse the link at
190-
(<http://dl.mongodb.org/dl/osx/i386>).
166+
The following steps are better suited for macOS/Linux-based systems, but with some modification they can be used for Windows systems as well (i.e., `$PATH` variable, Step 3). Here I describe the MongoDB installation from the official package, because I found that this approach is more robust and leads to less conflicts. However, there are many other ways to install it on macOS (<http://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x>), for example using Brew, as well as on other systems (<http://docs.mongodb.com/manual/installation>).
191167

192-
Tip To figure out the architecture type of your processor, type the $ uname -p at the command line.
168+
1. Download MongoDB from <http://www.mongodb.com/download-center#community>. For the latest Apple laptops, like MacBook, select macOS X 64-bit version. The owners of older Macs should browse the link at <http://dl.mongodb.com/dl/osx/i386>.
193169

194-
2. Unpack the package into your web development folder
195-
(~/Documents/Development or any other). If you want, you could
196-
install MongoDB into the /usr/local/mongodb folder.
170+
**Tip** To figure out the architecture type of your processor, type the $ uname -p at the command line.
197171

198-
3. Optional: If you would like to access MongoDB commands from anywhere
199-
on your system, you need to add your mongodb path to the
200-
$PATH variable. For macOS the open system *paths* file with:
172+
2. Unpack the package into your web development folder (`~/Documents/Development` or any other). If you want, you could install MongoDB into the `/usr/local/mongodb` folder.
173+
3. Optional: If you would like to access MongoDB commands from anywhere on your system, you need to add your `mongodb` path to the `$PATH` variable. For macOS, open system `/etc/paths` file with:
201174

202175
`sudo vi /etc/paths`
203176

204-
or, if you prefer TextMate:
177+
or, if you prefer VS Code:
205178

206-
`mate /etc/paths`
179+
`code /etc/paths`
207180

208181
And add this line to the /etc/paths file:
209182

210183
`/usr/local/mongodb/bin`
211184

212-
4. Create a data folder; by default, MongoDB uses /data/db. Please note
213-
that this might be different in new versions of MongoDB. To create
214-
it, type and execute the following commands in the terminal (Figure
215-
2-11):
185+
4. Create a `data` folder; by default, MongoDB uses `/data/db`. Please note that this might be different in new versions of MongoDB. To create it, type and execute the following commands in the terminal:
216186

217187
`$ sudo mkdir -p /data/db`
218188
`$ sudo chown id -u /data/db`
219189

220-
If you prefer to use a path other than /data/db you could specify it
221-
using the --dbpath option to mongod (the main MongoDB service).
190+
If you prefer to use a path other than `/data/db` you could specify it using the `--dbpath` option to `mongod` (the main MongoDB service).
222191

223-
5. Go to the folder where you unpacked MongoDB. That location should
224-
have a bin folder in it. From there, type the following command in
225-
your terminal:
192+
5. Go to the folder where you unpacked MongoDB. That location should have a bin folder in it. From there, type the following command in your terminal:
226193

227194
`$ ./bin/mongod`
228195

229-
6. If you see something like the following (and as in Figure 2-9) it
230-
means that the MongoDB database server is running:
196+
6. If you see something like the following (and as in Figure 2-3) it means that the MongoDB database server is running:
231197

232198
`MongoDB starting: pid =7218 port=27017...`
233199

234-
By default, it's listening at <http://localhost:27017>. If you go to
235-
your browser and type <http://localhost:28017> you should be able to see
236-
the version number, logs, and other useful information. In this case the
237-
MondoDB server is using two different ports (27017 and 28017): One is
238-
primary (native) for the communications with apps and the other is a
239-
web-based GUI for monitoring and statistics. In our Node.js code we'll
240-
be using only 27017. Don't forget to restart the Terminal window after
241-
adding a new path to the $PATH variable.
200+
By default, it's listening at <http://localhost:27017>. If you go to your browser and type <http://localhost:28017> you should be able to see the version number, logs, and other useful information. In this case the MondoDB server is using two different ports (27017 and 28017): One is primary (native) for the communications with apps and the other is a web-based GUI for monitoring and statistics. In our Node.js code we'll be using only 27017. Don't forget to restart the Terminal window after adding a new path to the `$PATH` variable.
242201

243202
![](media/image12.png)
244203

245-
***Figure 2-9.** Starting up the MongoDB server*
204+
***Figure 2-3.** Starting up the MongoDB server*
246205

247-
248-
Now, to take it even further, we can test to determine if we have access
249-
to the MongoDB console/shell, which will act as a client to this server.
250-
This means that we'll have to keep the terminal window with the server
251-
open and running.
206+
Now, to take it even further, we can test to determine if we have access to the MongoDB console/shell, which will act as a client to this server. This means that we'll have to keep the terminal window with the server open and running.
252207

253208
7. Open another terminal window at the same folder and execute:
254209

255210
`$ ./bin/mongo`
256211

257-
You should be able to see something like "MongoDB shell version 2.0.6
258-
..."
212+
You should see something like "MongoDB shell version..."
259213

260214
8. Then type and execute:
261215

262216
`> db.test.save( { a: 1 } )`
263217
`> db.test.find()`
264218

265219
If you see that your record is being saved, then everything went well
266-
(Figure 2-10).
220+
(Figure 2-4).
267221

268222

269223
![](media/image13.png)
270224

271-
***Figure 2-10.** Running MongoDB client and storing sample data*
225+
***Figure 2-4.** Running MongoDB client and storing sample data*
272226

273227
Commands `find` and `save` do exactly what you might think they do.
274228

275-
Detailed instructions are also available at MongoDB.org: Install MongoDB
276-
on OS X
277-
(<http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x>). For
278-
Windows users there is a good walk-through article at Installing MongoDB
279-
(<http://www.tuanleaded.com/blog/2011/10/installing-mongodb>).
229+
The official MongoDB website has the detailed instructions for installing MongoDB on macOS at: <http://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x>. TK
280230

281-
Note MAMP and XAMPP applications come with MySQL—an open source traditional SQL database—and phpMyAdmin—a web interface for MySQL database.
231+
**Note** MAMP and XAMPP applications come with MySQL—an open source traditional SQL database—and phpMyAdmin—a web interface for MySQL database.
282232

283-
On macOS (and most UNIX systems), to close the process use Control +
284-
C. If you use Control + Z it will put the process to sleep (or detach
285-
the terminal window); in this case, you might end up with the lock on
286-
data files and will have to use the kill command or Activity Monitor,
287-
and manually delete the locked file in the data folder. In vanilla Mac
233+
On macOS (and most UNIX systems), to close the process use Control + C. If you use Control + Z it will put the process to sleep (or detach the terminal window); in this case, you might end up with the lock on data files and will have to use the `kill` command or Activity Monitor, and manually delete the locked file in the data folder. In vanilla Mac
288234
Terminal Command + . is an alternative to Control + C.
289235

290-
Other Components
236+
Required Components
291237
----------------
292238

293-
These are required technologies. Please make sure you have them before
239+
The following are required technologies. Please make sure you have them before
294240
proceeding to the next chapter.
295241

296-
1. *Node.js:* We need it for build tools and back-end apps. Get version which has LTS even if the number is lower because LTS is the version which will be supported longer. <https://nodejs.org>
297-
2. *Browser JS libraries:* We need them for front-end apps.
298-
3. *LESS app:* We need it to compile LESS into CSS (macOS only).
299-
4. *Compass*: A desktop client GUI app for working with MongoDB as a replacement of the Mongo shell/REPL. <https://www.mongodb.com/products/compass>
242+
1. *Node.js*: We need it for build tools and back-end apps. Get the version that has LTS even if the number is lower than the current NON-LTS version, because the LTS versions have longer support period: <https://nodejs.org>.
243+
2. *npm*: The Node package manager that comes bundled with Node (no need to install anything extra).
244+
3. *Browser JS libraries*: We need them for front-end apps.
245+
246+
I highly recommend installing other optional but useful components:
247+
248+
1. *nvm*: The Node version manager, which allows to switch between Node versions quickly.
249+
2. *Compass*: A desktop client GUI app for working with MongoDB as a replacement of the Mongo shell/REPL. <https://www.mongodb.com/products/compass>
300250

301251
### Node.js Installation
302252

303-
Node.js is available at <http://nodejs.org/#download> (Figure 2-14). The
304-
installation is trivial: Download the archive and run the \*.pkg package
305-
installer. To check the installation of Node.js, you could type and
306-
execute:
253+
Node.js is available at <http://nodejs.org/#download> (Figure 2-5). The installation is trivial: Download the archive and run the `*.pkg` package installer. To check the installation of Node.js, you could type and execute:
307254

308255
`$ node -v`
309256

310-
I use v8.11.1 for this book and tested all examples with v8.11.1. If you
311-
use another version, do so at your own risk. I cannot guarantee that the
312-
examples will run.
313-
314-
Assuming you have 8.11.1, it should show something similar to this:
257+
I use v8.11.1 for this book and tested all examples with v8.11.1. If you use another version, do so at your own risk. I cannot guarantee that the examples will run.
315258

316-
`v8.11.1`
259+
Assuming you have 8.11.1, it should show something similar to this: `v8.11.1`.
317260

318-
If you want to switch between multiple versions of Node.js, there are
319-
solutions for that:
261+
If you want to switch between multiple versions of Node.js, there are solutions for that:
320262

321263
- [*nvm*](https://github.com/creationix/nvm) (https://github.com/creationix/nvm ): Node.js Version Manager
322-
323264
- [*Nave*](https://github.com/isaacs/nave)
324265
(https://github.com/isaacs/nave): Virtual environments for Node.js
325-
326266
- [*n*](https://github.com/tj/n) ( <https://github.com/tj/n> ): Node.js
327267
version management
328268

329-
The Node.js package already includes [Node Package
330-
Manager](https://npmjs.org) (https://npmjs.org) (NPM). We'll use NPM
331-
extensively to install Node.js modules—Figure 2-11.
269+
The Node.js package already includes npm—[Node Package Manager](https://npmjs.org) (<https://npmjs.org>). We'll use npm extensively to install Node.js modules.
332270

333271
![](media/image14.png)
334272

335-
***Figure 2-11**. Node.js home page*
273+
***Figure 2-5**. Node.js home page that shows LTS and non-LTS versions*
336274

337275
### Browser JavaScript Libraries
338276

Collapse file

‎chapter4/chapter4.md‎

Copy file name to clipboardExpand all lines: chapter4/chapter4.md
+2-2Lines changed: 2 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1712,7 +1712,7 @@ Require.js for Backbone.js Production
17121712
=====================================
17131713

17141714
<span id="requireJS" class="anchor"></span>We'll use the Node Package
1715-
Manager (NPM) to install the `requirejs` library (it's not a typo;
1715+
Manager (npm) to install the `requirejs` library (it's not a typo;
17161716
there's no period in the name). In your project folder, run this command
17171717
in a terminal:
17181718

@@ -1780,7 +1780,7 @@ https://github.com/azat-co/fullstack-javascript/tree/master/code/04-backbone/r/b
17801780

17811781
For uglification of JS files (which decreases the file sizes), we can
17821782
use the [Uglify2](https://github.com/mishoo/UglifyJS2) module. To
1783-
install it with NPM, use:
1783+
install it with npm, use:
17841784

17851785
$ npm install uglify-js
17861786

Collapse file

‎chapter6/chapter6.md‎

Copy file name to clipboardExpand all lines: chapter6/chapter6.md
+10-10Lines changed: 10 additions & 10 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Node.js Core Modules
112112

113113
Unlike other programming technologies, Node.js doesn't come with a heavy
114114
standard library. The core modules of node.js are a bare minimum and the
115-
rest can be cherry-picked via the Node Package Manager (NPM) registry.
115+
rest can be cherry-picked via the Node Package Manager (npm) registry.
116116
The main core modules, classes, methods, and events include:
117117

118118
- [http](http://nodejs.org/api/http.html)
@@ -215,8 +215,8 @@ The lists of non-core modules can be found at:
215215

216216
- [npmjs.org](https://npmjs.org): Node Package Manager registry
217217

218-
- Nipster (http://eirikb.github.io/nipster): NPM search
219-
[Nipster](http://eirikb.github.com/nipster): NPM search tool for
218+
- Nipster (http://eirikb.github.io/nipster): npm search
219+
[Nipster](http://eirikb.github.com/nipster): npm search tool for
220220
Node.js
221221

222222
- [node-modules(http://node-modules.com): npm search engine
@@ -229,14 +229,14 @@ the article located here:
229229
npm Node Package Manager
230230
------------------------
231231

232-
<span id="manager" class="anchor"></span>Node Package Manager, or NPM,
232+
<span id="manager" class="anchor"></span>Node Package Manager, or npm,
233233
manages dependencies and installs modules for you. Node.js installation
234-
comes with NPM, whose web site is [npmjs.org](http://npmjs.org).
234+
comes with npm, whose web site is [npmjs.org](http://npmjs.org).
235235

236236
`package.json` contains meta information about our Node.js application
237237
such as a version number; author name; and, most important, what
238238
dependencies we use in the application. All of that information is in
239-
the JSON formatted object, which is read by NPM.
239+
the JSON formatted object, which is read by npm.
240240

241241
If you would like to install packages and dependencies specified in
242242
`package.json`, type:
@@ -303,10 +303,10 @@ The only module used in this book's examples—and which does not belong
303303
to the core Node.js package—is `mongodb`. We'll install it later in the
304304
book.
305305

306-
Heroku will need `package.json` to run NPM on the server.
306+
Heroku will need `package.json` to run npm on the server.
307307

308-
For more information on NPM, take a look at the article "[Tour of
309-
NPM](http://tobyho.com/2012/02/09/tour-of-npm/)"
308+
For more information on npm, take a look at the article "[Tour of
309+
npm](http://tobyho.com/2012/02/09/tour-of-npm/)"
310310
(http://tobyho.com/2012/02/09/tour-of-npm)
311311

312312
Deploying "Hello World" to PaaS
@@ -837,6 +837,6 @@ Summary
837837

838838
In this chapter we've covered important topics that will lay the
839839
foundation. They exhibit the "Hello World" application in Node.js, list
840-
of some of its most important core modules, NPM workflow, detailed
840+
of some of its most important core modules, npm workflow, detailed
841841
commands for deployment of Node.js apps to Heroku and Windows Azure; and
842842
an example of a test-driven development practice.
Collapse file

‎chapter8/chapter8.md‎

Copy file name to clipboardExpand all lines: chapter8/chapter8.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ If there's no `epel`, run:
795795

796796
$ rpm -Uvh http://download-i2.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
797797

798-
Then, try to install both Node.js and NPM again with:
798+
Then, try to install both Node.js and npm again with:
799799

800800
$ sudo yum install nodejs npm --enablerepo=epel
801801

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.