Skip to content

Commit

Permalink
change to I in images everywhere in text
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-co committed Jul 15, 2017
1 parent 1f3cd1c commit 3943a36
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 59 deletions.
26 changes: 13 additions & 13 deletions Chapter1/chapter1.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ First, let’s go to <http://nodejs.org> and download a one-click installer for

The installers come with NPM (Node Package Manager)— an important tool for managing dependencies.

![alt](media/image1.png)
![alt](media/Image1.png)

***Figure 1-1.** One-click installers for Node.js*

If there’s no installer for your OS (page http://nodejs.org/download/), you can get the source code and compile it yourself (Figure 1-2).

![alt](media/image2.png)
![alt](media/Image2.png)

***Figure 1-2.** Multiple options for downloading*

Expand Down Expand Up @@ -240,7 +240,7 @@ $ npm -v

You should see the latest versions of Node.js and NPM that you just downloaded and installed, as shown in Figure 1-3.

![alt](media/image3.png)
![alt](media/Image3.png)

***Figure 1-3.** Checking Node.js and NPM installations*

Expand All @@ -267,7 +267,7 @@ The prompt should change from `$` to `>` (or something else, depending on your s

The result of the previous snippet is shown in Figure 1-4.

![alt](media/image4.png)
![alt](media/Image4.png)

***Figure 1-4.** Executing JavaScript in Node.js REPL*

Expand Down Expand Up @@ -535,7 +535,7 @@ So, let’s take a look at the main differences between Node.js and JavaScript.
Each Node.js script that runs is, in essence, a process. For example, `ps aux | grep 'node'` outputs all Node.js programs running on a machine. Conveniently, developers can access useful process information in code with the `process` object (e.g., `node -e "console.log(process.pid)"`), as shown in Figure 1-5.
![alt](media/image5.png)
![alt](media/Image5.png)
***Figure 1-5.** Node.js process examples using `pid` (process ID) and `cwd` (current working directory).*
Expand Down Expand Up @@ -903,7 +903,7 @@ Then, we start Node Inspector with the following (Figure 1-6):
$ node-inspector
![alt](media/image6.png)
![alt](media/Image6.png)
***Figure 1-6.** Running the Node Inspector tool*
Expand All @@ -915,33 +915,33 @@ or
$ node --debug hello-debug.js
![alt](media/image7.png)
![alt](media/Image7.png)
***Figure 1-7.** Running node server in `--debug` mode*
Open <http://127.0.0.1:8080/debug?port=5858> (or http://localhost:8080/debug?port=5858) in Chrome (it must be Chrome and not another browser because Node Inspector uses the Web Developer Tools interface). You should be able to see the program halted at a break point. Clicking the blue play button resumes the execution, as shown in Figure 1-8.
![alt](media/image8.png)
![alt](media/Image8.png)
***Figure 1-8.** Resuming execution in Node Inspector*
If we let the server run and open <http://localhost:1337/> in a new browser tab, this action pauses the execution on the second break point, which is inside the request handler. From here, we can use Node Inspector’s right GUI and add a `res` watcher (Figure 1-9), which is way better than the terminal window output!
![alt](media/image9.png)
![alt](media/Image9.png)
***Figure 1-9.** Inspecting `res` object in Node Inspector*
In addition, we can follow the call stack, explore scope variables, and execute any Node.js command in the console tab (Figure 1-10)!
![alt](media/image10.png)
![alt](media/Image10.png)
***Figure 1-10.** Writing to response (i.e., the `res` object) from the Node Inspector console*
# Node.js IDEs and Code Editors
One of the best things about Node.js is that you don’t need to compile the code, because it’s loaded into memory and interpreted by the platform! Therefore, a lightweight text editor is highly recommended, such as Sublime Text (Figure 1-11), vs. a full-blown IDE. However, if you are already familiar and comfortable with the IDE of your choice, such as [Eclipse](http://www.eclipse.org/)(<http://www.eclipse.org/>), [NetBeans](http://netbeans.org/)(<http://netbeans.org/>), or [Aptana](http://aptana.com)(<http://aptana.com/>), feel free to stick with it.
![alt](media/image11.png)
![alt](media/Image11.png)
***Figure 1-11.** Sublime Text code editor home page.*
Expand All @@ -959,13 +959,13 @@ The following is a list of the most popular text editors and IDEs used in web de
- [*WebStorm IDE*](*http://www.jetbrains.com/webstorm/*)(*<http://www.jetbrains.com/webstorm/>*): a feature-rich IDE that allows for Node.js debugging, developed by JetBrains and marketed as “the smartest JavaScript IDE” (Figure 1-12)
![alt](media/image12.png)
![alt](media/Image12.png)
***Figure 1-12.** WebStorm IDE home page.*
For most developers, a simple code editor such as Sublime Text 2, TextMate, or Emacs is good enough. However, for programmers who are used to working in IDEs, there’s WebStorm by JetBrains (http://www.jetbrains.com/webstorm). For an example of the WebStorm work space, see Figure 1-13.
![alt](media/image13.png)
![alt](media/Image13.png)
***Figure 1-13.** Webstorm IDE work space*
Expand Down
12 changes: 6 additions & 6 deletions Chapter10/chapter10.md
Original file line number Diff line number Diff line change
Expand Up @@ -507,13 +507,13 @@ The full source code of `practicalnode/ch10/cluster.js` is as follows:

As usual, to start an app, run `$ node cluster`. There should be four (or two, depending on your machine’s architecture) processes, as shown in Figure 10-1.

![alt](media/image1.png)
![alt](media/Image1.png)

***Figure 10-1.** Starting four processes with Cluster*

When we CURL with `$ curl http://localhost:3000`, there are different processes that listen to the *same* port and respond to us (Figure 10-2).

![alt](media/image2.png)
![alt](media/Image2.png)

***Figure 10-2.** Server response is rendered by different processes*

Expand Down Expand Up @@ -933,7 +933,7 @@ To run the task, simply execute `$ grunt` or `$ grunt default`.

The results of running `$ grunt `are shown in Figure 10-3.

![alt](media/image3.png)
![alt](media/Image3.png)

***Figure 10-3.** The results of the Grunt default task*

Expand Down Expand Up @@ -967,7 +967,7 @@ To install Git for your OS, download a package from [the official website](http:

git version 1.8.3.2

![alt](media/image4.png)
![alt](media/Image4.png)

**Figure 10-4.** Configuring and testing the Git installation

Expand Down Expand Up @@ -997,7 +997,7 @@ To generate SSH keys for GitHub on Mac OS X/Unix machines, do the following:

$ pbcopy < ~/.ssh/id_rsa.pub

![alt](media/image5.png)
![alt](media/Image5.png)

***Figure 10-5.** Generating an RSA (Ron Rivest (<http://en.wikipedia.org/wiki/Ron_Rivest>), Adi Shamir (<http://en.wikipedia.org/wiki/Adi_Shamir>) and Leonard Adleman (<http://en.wikipedia.org/wiki/Leonard_Adleman>)) key pair for SSH and copying the public RSA key to a clipboard*

Expand Down Expand Up @@ -1026,7 +1026,7 @@ then everything is set up.

While connecting to GitHub for the first time, you may receive the warning “authenticity of host . . . can’t be established.” Please don’t be confused with this message; just proceed by answering yes, as shown in Figure 10-6.

![alt](media/image6.png)
![alt](media/Image6.png)

***Figure 10-6.** Testing the SSH connection to GitHub for the very first
time*
Expand Down
8 changes: 4 additions & 4 deletions Chapter11/chapter11.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ To set up Heroku, follow these steps:

The system asks you for Heroku credentials (username and password), and if you’ve already created the SSH key, it uploads it automatically to the Heroku web site, as shown in Figure 11-1.

![alt](media/image1.png)
![alt](media/Image1.png)

***Figure 11-1.** The response to a successful `$ heroku login` command*

Expand Down Expand Up @@ -174,7 +174,7 @@ For official information on setting up environment variables in Heroku, see [Con

There are a multitude of [add-ons for Heroku](https://addons.heroku.com/) (https://addons.heroku.com). Each add-on is like a mini service associated with a particular Heroku app. For example, [MongoHQ](https://addons.heroku.com/mongohq) (https://addons.heroku.com/mongohq) provides MongoDB database, while the [Postgres add-on](https://addons.heroku.com/heroku-postgresql) (https://addons.heroku.com/heroku-postgresql) does the same for the PostgreSQL database, and [SendGrid](https://addons.heroku.com/sendgrid) (https://addons.heroku.com/sendgrid) allows sending transactional e-mails. In Figure 11-2, you can see the beginning of the long list of Heroku add-ons.

![alt](media/image2.png)
![alt](media/Image2.png)

***Figure 11-2.** There are a multitude of add-ons for Heroku*

Expand Down Expand Up @@ -313,13 +313,13 @@ The other fields fill automatically:
Port Range: 80
Source: 0.0.0.0/0

![alt](media/image3.png)
![alt](media/Image3.png)

***Figure 11-3.** Allowing inbound HTTP traffic on port 80*

Or we can just allow all traffic (again, for development purposes only), as shown in Figure 11-4.

![alt](media/image4.png)
![alt](media/Image4.png)

***Figure 11-4**. Allowing all traffic for development mode only*

Expand Down
24 changes: 12 additions & 12 deletions Chapter2/chapter2.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@ Of course, we can be more vague and tell NPM to install the latest version of `e

The Figure 2-1 shows us results of running the aforementioned command. Please notice the path in Figure 2-1: `/usr/local/lib/node_modules/express-generator`. This is where, on Max OS X / Linux systems, NPM puts global modules by default. We verify the availability of Express.js CLI by running `$ express –V`.

![alt](media/image1.png)
![alt](media/Image1.png)

***Figure 2-1.** The result of running NPM with `-g` and `$ express -V`*

## Local Express.js

For the local Express.js 4.1.2 module installation, let&#39;s create a new folder `express-cli` somewhere on your computer: `$ mkdir express-cli`. This will be our project folder for the chapter. Now we can open it with `$ cd express-cli`. When we are inside the project folder, we can create `package.json` manually in a text editor or with the `$ npm init` terminal command (Figure 2-2).

![alt](media/image2.png)
![alt](media/Image2.png)

***Figure 2-2.** The result of running `$ npm init`*

Expand Down Expand Up @@ -228,15 +228,15 @@ The following is the `package.json` file with an added Express.js v4.1.2 depende

In the Figure 2-3, we show the result of install Express.js v4.1.2 locally, into the `node_modules` folder. Please notice the path after the `[email protected]` string in Figure 2-3 this time it&#39;s local and not global, as in the case of `express-generator`.

![alt](media/image3.png)
![alt](media/Image3.png)

***Figure 2-3.** The result of running $ npm install*

If you want to install Express.js to an existing project and save the dependency (smart thing to do!) into the `package.json` file, which is already present in that project&#39;s folder, run `$ npm install [email protected] --save`.

To double-check the installation of Express.js and its dependencies, we can run the `$ npm ls` command, as shown in Figure 2-4.

![alt](media/image4.png)
![alt](media/Image4.png)

***Figure 2-4.** The result of running `$ npm ls`*

Expand Down Expand Up @@ -283,7 +283,7 @@ Then, as the instructions in the terminal tell us (Figure 2-5), type:

Open the browser of your choice at <http://localhost:3000>.

![alt](media/image5.png)
![alt](media/Image5.png)

***Figure 2-5.** The result of using Express.js Generator*

Expand Down Expand Up @@ -452,7 +452,7 @@ Our Blog app consists of five main parts from the user perspective:

- A post article page for adding new content

![alt](media/image6.png)
![alt](media/Image6.png)

***Figure 2-6.** The home page of the Blog app*

Expand All @@ -479,19 +479,19 @@ The source code for this mini-project is under `ch2/hello-world` folder of pract

The first approach is traditional and is considered more search engine optimization friendly, but it takes longer for users (especially on mobile) and is not as smooth as the second approach (Figure 2-7).

![alt](media/image7.png)
![alt](media/Image7.png)

***Figure 2-7.** Traditional server-side approach*

Sending and receiving data via REST API/HTTP requests and rendering HTML on the client side is used with front-end frameworks such as Backbone.js, Angular, Ember, and [many others](http://todomvc.com/)(<http://todomvc.com/>) (Figure 2-8). The use of these frameworks is becoming more and more common nowadays because it allows for more efficiency (HTML is rendered on the client side and only the data are transmitted) and better code organization.

![alt](media/image8.png)
![alt](media/Image8.png)

***Figure 2-8.** REST API approach diagram*

Under the hood, virtually all front-end frameworks use jQuery&#39;s `ajax()` method. So, to give you a realistic example, the admin page uses REST API end points via jQuery `$.ajax()` calls to manipulate the articles, including publish, unpublish, and remove (Figure 2-9).

![alt](media/image9.png)
![alt](media/Image9.png)

***Figure 2-9.** The admin page of Blog*

Expand Down Expand Up @@ -535,7 +535,7 @@ Let&#39;s choose a project folder `hello-world`, and create these directories wi

mkdir {public,public/css,public/img,public/js,db,views,views/includes,routes}

![alt](media/image10.png)
![alt](media/Image10.png)

***Figure 2-10.** Setting up folders*

Expand Down Expand Up @@ -680,7 +680,7 @@ The next section is where we define routes themselves (the order in `app.js` mat

Figure 2-11 shows how a trivial request might travel across the web and the Express.js app, with the dotted lines being the connection inside it.

![alt](media/image11.png)
![alt](media/Image11.png)

***Figure 2-11.** Following a simple request in an Express.js app*

Expand Down Expand Up @@ -773,7 +773,7 @@ There are more advanced examples of Jade included later in this book; but, for n

When we run the `$ node app` command and open browsers at <http://localhost:3000>, we see what appears in Figure 2-12.

![alt](media/image12.png)
![alt](media/Image12.png)

***Figure 2-12.** The Hello World app in action*

Expand Down
16 changes: 8 additions & 8 deletions Chapter4/chapter4.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ To add a `jade` dependency to your project, or if you&#39;re starting from scrat

- Install and add `jade` to `package.json` with `$ npm install jade –save`. See the results in Figure 4-1.

![alt](media/image1.png)
![alt](media/Image1.png)

***Figure 4-1.** Installing Jade*

Expand Down Expand Up @@ -438,7 +438,7 @@ We can extract these variables from multiple sources (databases, file systems, u

In this way, when we run `$ node jade-example.js 'email body'`, we get the output shown in Figure 4-2.

![alt](media/image2.png)
![alt](media/Image2.png)

***Figure 4-2.** The result of `jade-example` output*

Expand Down Expand Up @@ -770,7 +770,7 @@ Includes or partials templates in Handlebars are interpreted by the `{{> partial

Developers can install Handlebars via NPM with `$ npm install handlebars` or `$ npm install handlebars --save`, assuming there&#39;s either `node_modules` or `package.json` in the current working directory (see the results of a sample installation in Figure 4-3).

![alt](media/image3.png)
![alt](media/Image3.png)

***Figure 4-3.** Installing Handlebars*

Expand Down Expand Up @@ -1098,7 +1098,7 @@ The full code of `index.jade` is as follows:

Figure 4-4 shows how the home page looks after adding style sheets.

![alt](media/image4.png)
![alt](media/Image4.png)

***Figure 4-4.** The home page*

Expand All @@ -1113,7 +1113,7 @@ The individual article page (Figure 4-5) is relatively unsophisticated because m
h1= title
p= text

![alt](media/image5.png)
![alt](media/Image5.png)

***Figure 4-5.** The article page*

Expand Down Expand Up @@ -1141,7 +1141,7 @@ Similarly, the login page contains only a form and a button (with the Twitter Bo

Figure 4-6 shows how the login page looks.

![alt](media/image6.png)
![alt](media/Image6.png)

***Figure 4-6.** The login page*

Expand Down Expand Up @@ -1171,7 +1171,7 @@ The post page (Figure 4-7) has another form. This time, the form contains a text
p
button.btn.btn-primary(type="submit") Save

![alt](media/image7.png)
![alt](media/Image7.png)

***Figure 4-7.** The post page*

Expand Down Expand Up @@ -1217,7 +1217,7 @@ And, a conditional (ternary) operator (<https://github.com/donpark/hbs>) is used

span.glyphicon(class=(article.published)?"glyphicon-pause":"glyphicon-play", title=(article.published)?"Unpublish":"Publish")

![alt](media/image8.png)
![alt](media/Image8.png)

***Figure 4-8.** The admin page*

Expand Down
Loading

0 comments on commit 3943a36

Please sign in to comment.