@@ -17,47 +17,28 @@ In this chapter, we'll cover the following topics: |
17 | 17 |
|
18 | 18 | - Preparation for the use of cloud services |
19 | 19 |
|
20 | | -The proper setup is absolutely crucial to the productive development. |
21 | | -You need to have everything ready when you embark on a long journey, |
22 | | -right? The toolset will make you productive, and the other installations |
23 | | -are dependencies like Node.js or MongoDB. They enable the server-side |
24 | | -code and persistence, respectively. In addition to that, in the cloud |
25 | | -section, we cover setup of the services for deployment and development. |
26 | | -They will enable you to keep your code under version control and deploy |
27 | | -in a scalable manner. |
| 20 | +The proper setup is absolutely crucial to your productive development. You need to have everything ready when you embark on a long journey, right? The two important things to install are dependencies and the toolset. Dependencies are absolutely necessary and technologies like Node.js or MongoDB. Moreover, the toolset is highly recommended because it will make you more productive. They enable the server-side code and persistence, respectively. In addition to that, in the cloud section, we cover setup of the services for deployment and development. They will enable you to keep your code under version control and deploy it in a scalable manner. |
28 | 21 |
|
29 | 22 | Local Setup |
30 | 23 | =========== |
31 | 24 |
|
32 | | -Local setup is what we use on our development machines when we work on |
33 | | -the project. It includes anything from folders, browsers, editors, and |
34 | | -HTTP servers to databases. Figure 2-1 shows an example of the initial |
35 | | -development environment setup. |
| 25 | +Local setup is what we use on our development machines when we work on a project. It includes anything from folders, browsers, editors, and HTTP servers to databases. Figure 2-1 shows an example of the initial development environment setup. |
36 | 26 |
|
37 | 27 | Development Folder |
38 | 28 | ------------------ |
39 | 29 |
|
40 | | -If you don't have a specific development folder for your web development |
41 | | -projects, you could create a Development folder in the Documents folder |
42 | | -(path will be Documents/Development). To work on the code example, |
43 | | -create a fullstack-javascript folder inside your web development |
44 | | -projects folder; for example, if you create a <span id="OLE_LINK1" |
45 | | -class="anchor"><span id="OLE_LINK2" |
46 | | -class="anchor"></span></span>fullstack-javascript folder inside of the |
47 | | -Development folder, the path will be |
48 | | -Documents/Development/fullstack-javascript. You could use the Finder on |
49 | | -Mac OS X or the following terminal commands on OS X/Linux systems: |
| 30 | +If you don't have a specific development folder for your web development projects, you could create a `Development` folder in the `Documents` folder (path will be `Documents/Development`). To work on the code example, create a `fullstack-javascript` folder inside your web development projects folder; for example, if you create a `fullstack-javascript` folder inside of the `Development` folder, the path will be `Documents/Development/fullstack-javascript`. You could use the Finder app on macOS or the following terminal commands on Posix (macOS X/Linux) systems: |
50 | 31 |
|
51 | 32 | `$ cd ~/Documents` |
52 | 33 | `$ mkdir Development` |
53 | 34 | `$ cd Development` |
54 | 35 | `$ mkdir fullstack-javascript` |
55 | 36 |
|
56 | | - |
| 37 | + |
57 | 38 |
|
58 | 39 | ***Figure 2-1.** Initial development environment setup* |
59 | 40 |
|
60 | | - Tip To open Mac OS Finder app in the current directory from Terminal, just type and run the $ open . command. On Windows, Terminal is command prompt. |
| 41 | +**Tip** To open Mac OS Finder app in the current directory from Terminal, just type and run the $ open . command. On Windows, Terminal is command prompt. |
61 | 42 |
|
62 | 43 | To get the list of files and folders, use this UNIX/Linux command: |
63 | 44 |
|
@@ -67,186 +48,100 @@ or to display hidden files and folders, like .git, use this: |
67 | 48 |
|
68 | 49 | `$ ls -lah` |
69 | 50 |
|
70 | | -Another alternative to $ ls is $ ls -alt. The difference between the |
71 | | --lah and the -alt options is that the latter sorts items chronologically |
72 | | -and the former sorts them alphabetically. |
| 51 | +Another alternative to `$ ls` is `$ ls -alt`. The difference between the `-lah` and the `-alt` options is that the latter sorts items chronologically and the former sorts them alphabetically. |
73 | 52 |
|
74 | 53 | You can use the Tab key to autocomplete names of the files and folders. |
75 | 54 |
|
76 | | -Later, you could copy examples into the fullstack-javascript folder as |
77 | | -well as create apps in that folder. |
| 55 | +Later, you could copy examples into the `fullstack-javascript` folder as well as create apps in that folder. |
78 | 56 |
|
79 | | - Tip Another useful thing is to have the New Terminal at Folder option in Finder on Mac OS X. To enable it, open your System Preferences (you could use Command + Space, a.k.a. Spotlight, for it). Find Keyboard and click it. Open Keyboard Shortcuts and click Services. Select the New Terminal at Folder and New Terminal Tab at Folder check boxes. Close the window (optional). |
| 57 | +**Tip** Another useful thing is to have the New Terminal at Folder option in Finder on Mac OS X. To enable it, open your System Preferences (you could use Command + Space, a.k.a. Spotlight, for it). Find Keyboard and click it. Open Keyboard Shortcuts and click Services. Select the New Terminal at Folder and New Terminal Tab at Folder check boxes. Close the window (optional). |
80 | 58 |
|
81 | 59 | Browsers |
82 | 60 | -------- |
83 | 61 |
|
84 | | -We recommend downloading the latest version of the |
85 | | -[WebKit](http://en.wikipedia.org/wiki/WebKit) |
86 | | -(http://en.wikipedia.org/wiki/WebKit) or Gecko at |
87 | | -http://en.wikipedia.org/wiki/Gecko_(layout_engine) browser of your |
88 | | -choice: |
| 62 | +I recommend downloading the latest version of the WebKit or Gecko browser of your choice: |
89 | 63 |
|
90 | | -- [Chrome](http://www.google.com/chrome) (<http://www.google.com/chrome>) |
91 | | - (recommended) |
| 64 | +- [Chrome](https://www.google.com/chrome) (<https://www.google.com/chrome>) (recommended) |
| 65 | +- [Safari](https://www.apple.com/safari) (<https://www.apple.com/safari>) |
| 66 | +- [Firefox](https://www.mozilla.org/en-US/firefox/new) (<https://www.mozilla.org/en-US/firefox/new>) |
92 | 67 |
|
93 | | -- [Safari](http://www.apple.com/safari) (<http://www.apple.com/safari>) |
| 68 | +Whereas Chrome (Figure 2-2) and Safari already come with built-in developer tools, you'll need the Firebug plug-in for Firefox . |
94 | 69 |
|
95 | | -- [Firefox](http://www.mozilla.org/en-US/firefox/new) (<http://www.mozilla.org/en-US/firefox/new>) |
96 | | - |
97 | | -Whereas Chrome and Safari already come with built-in developer tools, |
98 | | -you'll need the Firebug plug-in for Firefox (Figure 2-2). |
99 | | - |
100 | | - |
101 | | - |
| 70 | + |
102 | 71 |
|
103 | 72 | ***Figure 2-2.** Chrome Developer Tools in action* |
104 | 73 |
|
105 | | -Firebug and developer tools allow developers to do many things, |
106 | | -including these: |
| 74 | +Firebug and developer tools allow developers to do many things, including these: |
107 | 75 |
|
108 | 76 | - Debug JavaScript |
109 | | - |
110 | 77 | - Manipulate HTML and DOM elements |
111 | | - |
112 | 78 | - Modify CSS on the fly |
113 | | - |
114 | 79 | - Monitor HTTP requests and responses |
115 | | - |
116 | 80 | - Run profiles and inspect heap dumps |
117 | | - |
118 | 81 | - See loaded assets such as images, CSS, and JS files |
119 | 82 |
|
120 | | - |
121 | | - |
122 | | -***Figure 2-3**. Google tutorials for mastering web developer tools* |
123 | 83 |
|
124 | 84 | There are some great Chrome Developer Tools (DevTools) tutorials, such |
125 | | -as the following and those shown in Figures 2-3 and 2-4: |
126 | | - |
127 | | -- Explore and Master Chrome DevTools |
128 | | - (<http://discover->devtools.codeschool.com/ ) with Code School |
| 85 | +as the following: |
129 | 86 |
|
| 87 | +- Explore and Master Chrome DevTools (<https://discover-devtools.codeschool.com> ) with Code School |
130 | 88 | - Chrome DevTools videos (<https://developers.google.com/chrome-developer-tools/docs/videos>) |
| 89 | +- Chrome DevTools overview (<https://developers.google.com/chrome-developer-tools>) |
131 | 90 |
|
132 | | -- Chrome DevTools overview |
133 | | - (<https://developers.google.com/chrome-developer-tools>) |
134 | | - |
135 | | - |
136 | | - |
137 | | -***Figure 2-4.** Mastering Chrome DevTools* |
138 | 91 |
|
139 | 92 | IDEs and Text Editors |
140 | 93 | --------------------- |
141 | 94 |
|
142 | | -One of the best things about JavaScript is that you don't need to |
143 | | -compile the code. Because JS lives in and is run in a browser, you can |
144 | | -do debugging right there, in a browser! It's an interpreted language, |
145 | | -not a compiled one. Therefore, we highly recommend a lightweight text |
146 | | -editor instead of a full-blown integrated development environment |
147 | | -(<http://en.wikipedia.org/wiki/Integrated_development_environment>), or |
148 | | -IDE, but if you are already familiar and comfortable with the IDE of |
149 | | -your choice like Eclipse, (<http://www.eclipse.org>) NetBeans (<http://netbeans.org>) or Aptana (<http://aptana.com>), feel free to stick |
150 | | -with it. |
151 | | - |
152 | | -Here is the list of the most popular text editors and IDEs used in web |
153 | | -development: |
154 | | - |
155 | | -- [*MS Visual |
156 | | - Studio*](https://www.visualstudio.com/features/node-js-vs) |
157 | | - (<https://www.visualstudio.com/features/node-js-vs>): Node.js tools |
158 | | - for the famous Visual Studio environment from a small |
159 | | - Redmond, Washington-based software startup company. |
160 | | -- [*Atom*](https://atom.io) (https://atom.io): A web editor built on web technologies from the creators of GitHub the world's largest code storage and collaboration space. |
161 | | -- [*Sublime Text*](http://www.sublimetext.com) |
162 | | - (<http://www.sublimetext.com>): Mac OS X and Windows versions |
163 | | - are available. This is an even better alternative to TextMate, with |
164 | | - an unlimited evaluation period |
165 | | - (Figure 2-5 ). |
| 95 | +One of the best things about JavaScript is that you don't need to compile the code. Because JS lives in and is run in a browser, you can do debugging right there, in a browser! It's an interpreted language, not a compiled one. Therefore, I highly recommend a lightweight text editor instead of a full-blown integrated development environment, or IDE, but if you are already familiar and comfortable with the IDE of your choice like Eclipse (<http://www.eclipse.org>), NetBeans (<http://netbeans.org>), or Aptana (<http://aptana.com>), feel free to stick with it. |
166 | 96 |
|
167 | | -- [*Coda*](http://panic.com/coda) (<http://panic.com/coda>): |
168 | | - All-in-one editor with FTP browser and preview, has support for |
169 | | - development with and on an iPad. |
170 | | - |
171 | | -- [*Aptana Studio*](http://aptana.com) (<http://aptana.com>): |
172 | | - Full-sized IDE with a built-in terminal and many other tools. |
173 | | - |
174 | | -- [*WebStorm IDE*](http://www.jetbrains.com/webstorm) |
175 | | - (<http://www.jetbrains.com/webstorm>): Feature- rich IDE that allows |
176 | | - for Node.js debugging. It is developed by JetBrains and marketed as |
177 | | - the smartest JavaScript IDE (Figure 2-6 ). |
178 | | - |
179 | | - |
180 | | -Please, please, please don't use TextEdit or Notepad++! Having code coloring and parenthesis matching will make a great difference when typing and debugging. |
| 97 | +Here is a list of the most popular text editors and IDEs used in web |
| 98 | +development: |
181 | 99 |
|
182 | | - |
| 100 | +- [*VS Code*](https://www.visualstudio.com/features/node-js-vs) (<https://www.visualstudio.com/features/node-js-vs>): Node.js tools for the famous Visual Studio environment from a small Redmond, Washington-based software startup company. |
| 101 | +- [*Atom*](https://atom.io) (<https://atom.io>): A web editor built on web technologies from the creators of GitHub the world's largest code storage and collaboration space. |
| 102 | +- [*Sublime Text*](https://www.sublimetext.com) (<https://www.sublimetext.com>): Mac OS X and Windows versions are available. This is an even better alternative to TextMate, with an unlimited evaluation period. |
| 103 | +- [*Coda*](http://panic.com/coda) (<http://panic.com/coda>): All-in-one editor with FTP browser and preview, has support for development with and on an iPad. |
| 104 | +- [*Aptana Studio*](http://aptana.com) (<http://aptana.com>): Full-sized IDE with a built-in terminal and many other tools. |
| 105 | +- [*WebStorm*](http://www.jetbrains.com/webstorm) (<http://www.jetbrains.com/webstorm>): Feature-rich IDE that allows for Node.js debugging. It is developed by JetBrains and marketed as the smartest JavaScript IDE. |
183 | 106 |
|
184 | | -***Figure 2-5.** Sublime Text code editor home page* |
185 | 107 |
|
186 | | - |
| 108 | +Please, please, please don't use Vim, TextEdit or Notepad++! Having code coloring and parentheses matching will make a great difference when typing and debugging. |
187 | 109 |
|
188 | | -***Figure 2-6.** WebStorm IDE home page* |
189 | 110 |
|
190 | 111 | Version Control Systems |
191 | 112 | ----------------------- |
192 | 113 |
|
193 | | -A version control system ( |
194 | | -<http://en.wikipedia.org/wiki/Revision_control>) is a must-have even in |
195 | | -an only-one-developer situation. Also many cloud services (e.g., Heroku) |
196 | | -require Git for deployment. We also highly recommend getting used to Git |
197 | | -and Git terminal commands instead of using Git visual clients and apps |
198 | | -with a GUI: GitX (<http://gitx.frim.nl>), Gitbox |
199 | | -(<http://www.gitboxapp.com>) or GitHub for Mac (<http://mac.github.com>). |
200 | | - |
201 | | -Subversion is a nondistributed version control system. This article |
202 | | -compares Git vs. Subversion |
203 | | -(<https://git.wiki.kernel.org/index.php/GitSvnComparison>). |
| 114 | +A version control system is a must-have even in projects with a single developer because such a system keep all the history which makes it easy to restore code or revert changes. Git is the most popular version control system. |
204 | 115 |
|
205 | | -Here are the steps to install and set up Git on your machine: |
| 116 | +Also, many cloud services (e.g., Heroku) require Git for deployment. I also highly recommend getting used to Git and Git terminal commands instead of using Git visual clients and apps with a GUI: GitX (<http://gitx.frim.nl>), Gitbox (<http://www.gitboxapp.com>), or GitHub for Desktop (<https://desktop.github.com>). |
206 | 117 |
|
207 | | -1. Download the latest version for your OS at |
208 | | - <http://git-scm.com/downloads> (Figure 2-7). |
| 118 | +Subversion is a nondistributed version control system. This article compares Git vs. Subversion: <https://git.wiki.kernel.org/index.php/GitSvnComparison>). |
209 | 119 |
|
210 | | -  |
211 | | - |
212 | | - ***Figure 2-7.** Downloading latest release of Git* |
213 | | - |
214 | | - |
215 | | -2. Install Git from the downloaded `\*.dmg` package; that is, run the |
216 | | - `\*.pkg` file and follow the wizard. |
217 | | - |
218 | | -3. Find the terminal app by using Command + Space, a.k.a. Spotlight |
219 | | - (Figure 2-8), on OS X. For Windows you could use |
220 | | - [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty) |
221 | | - (<http://www.chiark.greenend.org.uk/~sgtatham/putty>) |
222 | | - or Cygwin (<http://www.cygwin.com>). |
| 120 | +Here are the steps to install and set up Git on your machine: |
223 | 121 |
|
| 122 | +1. Download the latest version for your OS at <https://git-scm.com/downloads>. |
224 | 123 |
|
225 | | -  |
226 | 124 |
|
| 125 | +2. Install Git from the downloaded `\*.dmg` package; that is, run the `\*.pkg` file and follow the wizard. |
227 | 126 |
|
228 | | - ***Figure 2-8.** Using Spotlight to find and run an application* |
| 127 | +3. Find the Terminal app by using Command + Space, a.k.a. Spotlight, on macOS. For Windows you could use [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty) (<http://www.chiark.greenend.org.uk/~sgtatham/putty>) or Cygwin (<http://www.cygwin.com>). |
229 | 128 |
|
230 | 129 |
|
231 | | -4. In your terminal, type these commands, substituting "John Doe" and |
232 | | - |
| 130 | +4. In your terminal, type these commands, substituting "John Doe" and [email protected] with your name and e-mail: |
233 | 131 |
|
234 | 132 | `$ git config --global user.name "John Doe"` |
235 | 133 | |
236 | 134 |
|
237 | | -5. To check the installation, run command: |
| 135 | +5. To check the installation, run this command: |
238 | 136 |
|
239 | 137 | `$ git version` |
240 | 138 |
|
241 | | -6. You should see something like this in your terminal window (your |
242 | | - version might vary; in our case it's 1.8.3.2, as shown in Figure |
243 | | - 2-9): |
| 139 | +6. You should see something like this in your terminal window (your version might vary; in my case it's 1.8.3.2): |
244 | 140 |
|
245 | 141 | `git version 2.14.3 (Apple Git-98)` |
246 | 142 |
|
247 | 143 |
|
248 | | -Generating SSH keys and uploading them to SaaS/PaaS web sites will be |
249 | | -covered later. |
| 144 | +Generating SSH keys and uploading them to SaaS/PaaS web sites will be covered later. |
250 | 145 |
|
251 | 146 | Local HTTP Servers |
252 | 147 | ================== |
@@ -261,22 +156,14 @@ I recommend you use Node-based tools as static web servers. They lack |
261 | 156 | GUIs, but they are simple and fast. You can install them with npm (comes |
262 | 157 | with Node.js; instructions are later in this chapter): |
263 | 158 |
|
264 | | -- [*node-static*](https://github.com/cloudhead/node-static) ( |
265 | | - <https://github.com/cloudhead/node-static>): Static file server with |
266 | | - built-in caching. Run `npm i -g node-static` to install. |
| 159 | +- [*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. |
267 | 160 |
|
268 | | -- [*http-server*](https://www.npmjs.com/package/http-server) |
269 | | - (<https://www.npmjs.com/package/http-server>): Zero-configuration |
270 | | - command-line HTTP server. Run `npm i -g htt-server` to install. |
| 161 | +- [*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. |
271 | 162 |
|
272 | | -If you prefer something with GUIs to a command-line interface (CLI), you |
273 | | -might want to consider the following modifications of the Apache web |
274 | | -server. MAMP, MAMP Stack, and XAMPP have intuitive GUIs that allow you |
275 | | -to change configurations and host file settings. |
| 163 | +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. |
276 | 164 |
|
277 | 165 | - [*MAMP*](<http://www.mamp.info/en/index.html>) (<http://www.mamp.info/en/index.html>): Mac, Apache, MySQL, |
278 | 166 | PHP personal web server for Mac OS X. |
279 | | - |
280 | 167 | - [*MAMP Stack*](http://bitnami.com/stack/mamp) |
281 | 168 | (<http://bitnami.com/stack/mamp>): Mac app with PHP, Apache, MySQL, |
282 | 169 | and phpMyAdmin stack build by BitNami (Apple App Store) |
|