Preface |
|
xiii | |
|
|
1 | (10) |
|
The JavaScript Revolution |
|
|
1 | (2) |
|
|
3 | (1) |
|
Server-Side and Client-Side Applications |
|
|
4 | (1) |
|
A Brief History of Express |
|
|
5 | (1) |
|
Node: A New Kind of Web Server |
|
|
5 | (2) |
|
|
7 | (1) |
|
|
8 | (1) |
|
|
9 | (2) |
|
2 Getting Started with Node |
|
|
11 | (10) |
|
|
11 | (1) |
|
|
12 | (1) |
|
|
13 | (1) |
|
|
14 | (1) |
|
A Simple Web Server with Node |
|
|
15 | (5) |
|
|
15 | (1) |
|
|
16 | (1) |
|
|
17 | (1) |
|
|
18 | (2) |
|
|
20 | (1) |
|
3 Saving Time with Express |
|
|
21 | (10) |
|
|
21 | (1) |
|
The Meadowlark Travel Website |
|
|
22 | (1) |
|
|
22 | (4) |
|
|
26 | (3) |
|
|
29 | (1) |
|
|
30 | (1) |
|
|
30 | (1) |
|
|
31 | (10) |
|
File and Directory Structure |
|
|
31 | (1) |
|
|
32 | (1) |
|
|
32 | (1) |
|
How to Use Git with This Book |
|
|
33 | (3) |
|
If You're Following Along by Doing It Yourself |
|
|
33 | (2) |
|
If You're Following Along by Using the Official Repository |
|
|
35 | (1) |
|
|
36 | (1) |
|
|
37 | (1) |
|
|
38 | (2) |
|
|
40 | (1) |
|
|
41 | (18) |
|
|
42 | (1) |
|
|
43 | (1) |
|
Logic Versus Presentation |
|
|
44 | (1) |
|
|
45 | (1) |
|
Overview of QA Techniques |
|
|
45 | (1) |
|
Installing and Configuring Jest |
|
|
45 | (1) |
|
|
46 | (5) |
|
|
47 | (1) |
|
Refactoring the Application for Testability |
|
|
47 | (1) |
|
|
48 | (2) |
|
|
50 | (1) |
|
|
50 | (1) |
|
|
51 | (3) |
|
|
54 | (4) |
|
|
58 | (1) |
|
|
58 | (1) |
|
6 The Request and Response Objects |
|
|
59 | (14) |
|
|
59 | (2) |
|
|
61 | (1) |
|
|
61 | (1) |
|
|
62 | (1) |
|
|
62 | (1) |
|
|
63 | (1) |
|
|
63 | (2) |
|
|
65 | (2) |
|
|
67 | (1) |
|
|
68 | (4) |
|
|
68 | (1) |
|
|
69 | (1) |
|
|
70 | (2) |
|
|
72 | (1) |
|
7 Templating with Handlebars |
|
|
73 | (16) |
|
There Are No Absolute Rules Except This One |
|
|
75 | (1) |
|
Choosing a Template Engine |
|
|
75 | (1) |
|
Pug: A Different Approach |
|
|
76 | (1) |
|
|
77 | (11) |
|
|
78 | (1) |
|
|
78 | (2) |
|
|
80 | (1) |
|
|
81 | (1) |
|
Using Layouts (or Not) in Express |
|
|
82 | (1) |
|
|
83 | (2) |
|
|
85 | (2) |
|
Perfecting Your Templates |
|
|
87 | (1) |
|
|
88 | (1) |
|
|
89 | (14) |
|
Sending Client Data to the Server |
|
|
89 | (1) |
|
|
90 | (1) |
|
|
91 | (1) |
|
Different Approaches to Form Handling |
|
|
91 | (2) |
|
Form Handling with Express |
|
|
93 | (2) |
|
Using Fetch to Send Form Data |
|
|
95 | (2) |
|
|
97 | (3) |
|
|
99 | (1) |
|
|
100 | (1) |
|
|
100 | (3) |
|
|
103 | (10) |
|
Externalizing Credentials |
|
|
105 | (1) |
|
|
106 | (1) |
|
|
107 | (1) |
|
|
107 | (3) |
|
|
108 | (1) |
|
|
109 | (1) |
|
Using Sessions to Implement Flash Messages |
|
|
110 | (2) |
|
|
112 | (1) |
|
|
112 | (1) |
|
|
113 | (8) |
|
|
114 | (1) |
|
|
115 | (3) |
|
|
118 | (2) |
|
|
120 | (1) |
|
|
120 | (1) |
|
|
121 | (12) |
|
|
121 | (1) |
|
|
122 | (1) |
|
|
122 | (1) |
|
|
123 | (1) |
|
|
123 | (1) |
|
|
124 | (3) |
|
|
125 | (1) |
|
Sending Mail to Multiple Recipients |
|
|
126 | (1) |
|
Better Options for Bulk Email |
|
|
127 | (1) |
|
|
127 | (4) |
|
|
127 | (1) |
|
Using Views to Send HTML Email |
|
|
128 | (2) |
|
Encapsulating Email Functionality |
|
|
130 | (1) |
|
|
131 | (2) |
|
|
133 | (14) |
|
|
133 | (1) |
|
Environment-Specific Configuration |
|
|
134 | (2) |
|
Running Your Node Process |
|
|
136 | (1) |
|
|
137 | (6) |
|
Scaling Out with App Clusters |
|
|
138 | (2) |
|
Handling Uncaught Exceptions |
|
|
140 | (2) |
|
Scaling Out with Multiple Servers |
|
|
142 | (1) |
|
|
143 | (1) |
|
Third-Party Uptime Monitors |
|
|
143 | (1) |
|
|
143 | (2) |
|
|
145 | (2) |
|
|
147 | (26) |
|
|
147 | (2) |
|
|
149 | (1) |
|
|
150 | (19) |
|
|
151 | (1) |
|
Abstracting the Database Layer |
|
|
151 | (2) |
|
|
153 | (1) |
|
|
154 | (1) |
|
Database Connections with Mongoose |
|
|
154 | (1) |
|
Creating Schemas and Models |
|
|
155 | (1) |
|
|
156 | (2) |
|
|
158 | (2) |
|
|
160 | (2) |
|
|
162 | (6) |
|
|
168 | (1) |
|
Using a Database for Session Storage |
|
|
169 | (3) |
|
|
172 | (1) |
|
|
173 | (12) |
|
|
175 | (1) |
|
|
175 | (2) |
|
Route Handlers Are Middleware |
|
|
177 | (1) |
|
Route Paths and Regular Expressions |
|
|
178 | (1) |
|
|
179 | (1) |
|
|
180 | (1) |
|
Declaring Routes in a Module |
|
|
181 | (1) |
|
Grouping Handlers Logically |
|
|
182 | (1) |
|
Automatically Rendering Views |
|
|
183 | (1) |
|
|
184 | (1) |
|
|
185 | (10) |
|
|
186 | (1) |
|
|
186 | (1) |
|
|
187 | (1) |
|
Cross-Origin Resource Sharing |
|
|
188 | (1) |
|
|
189 | (2) |
|
Using Express to Provide an API |
|
|
191 | (1) |
|
|
192 | (3) |
|
16 Single-Page Applications |
|
|
195 | (22) |
|
A Short History of Web Application Development |
|
|
195 | (3) |
|
|
198 | (1) |
|
|
199 | (1) |
|
|
200 | (15) |
|
|
202 | (2) |
|
|
204 | (2) |
|
Vacations Page---Visual Design |
|
|
206 | (1) |
|
Vacations Page---Server Integration |
|
|
207 | (3) |
|
Sending Information to the Server |
|
|
210 | (2) |
|
|
212 | (3) |
|
|
215 | (1) |
|
|
215 | (2) |
|
|
217 | (8) |
|
Performance Considerations |
|
|
218 | (1) |
|
Content Delivery Networks |
|
|
219 | (1) |
|
|
220 | (1) |
|
|
220 | (1) |
|
|
221 | (1) |
|
|
221 | (1) |
|
Changing Your Static Content |
|
|
222 | (1) |
|
|
223 | (2) |
|
|
225 | (26) |
|
|
225 | (8) |
|
Generating Your Own Certificate |
|
|
226 | (1) |
|
Using a Free Certificate Authority |
|
|
227 | (1) |
|
|
228 | (2) |
|
Enabling HTTPS for Your Express App |
|
|
230 | (1) |
|
|
231 | (1) |
|
|
232 | (1) |
|
Cross-Site Request Forgery |
|
|
233 | (1) |
|
|
234 | (16) |
|
Authentication Versus Authorization |
|
|
234 | (1) |
|
The Problem with Passwords |
|
|
235 | (1) |
|
Third-Party Authentication |
|
|
236 | (1) |
|
Storing Users in Your Database |
|
|
236 | (2) |
|
Authentication Versus Registration and the User Experience |
|
|
238 | (1) |
|
|
238 | (10) |
|
|
248 | (1) |
|
Adding Authentication Providers |
|
|
249 | (1) |
|
|
250 | (1) |
|
19 Integrating with Third-Party APIs |
|
|
251 | (16) |
|
|
251 | (7) |
|
Social Media Plugins and Site Performance |
|
|
251 | (1) |
|
|
252 | (3) |
|
|
255 | (3) |
|
|
258 | (5) |
|
|
258 | (2) |
|
|
260 | (2) |
|
|
262 | (1) |
|
|
263 | (2) |
|
|
265 | (2) |
|
|
267 | (12) |
|
The First Principle of Debugging |
|
|
267 | (1) |
|
Take Advantage of REPL and the Console |
|
|
268 | (1) |
|
Using Node's Built-in Debugger |
|
|
269 | (1) |
|
|
270 | (4) |
|
Debugging Asynchronous Functions |
|
|
274 | (1) |
|
|
274 | (3) |
|
|
277 | (2) |
|
|
279 | (14) |
|
Domain Registration and Hosting |
|
|
279 | (11) |
|
|
280 | (1) |
|
|
281 | (1) |
|
|
281 | (1) |
|
|
282 | (1) |
|
|
283 | (2) |
|
|
285 | (2) |
|
|
287 | (3) |
|
|
290 | (3) |
|
|
293 | (10) |
|
The Principles of Maintenance |
|
|
293 | (7) |
|
|
293 | (2) |
|
|
295 | (1) |
|
|
295 | (1) |
|
|
296 | (1) |
|
|
296 | (1) |
|
|
296 | (1) |
|
|
297 | (1) |
|
|
297 | (1) |
|
|
298 | (1) |
|
Prevent "Invisible" Failures |
|
|
299 | (1) |
|
Code Reuse and Refactoring |
|
|
300 | (2) |
|
|
300 | (1) |
|
|
300 | (2) |
|
|
302 | (1) |
|
|
303 | (8) |
|
|
303 | (1) |
|
|
304 | (1) |
|
|
304 | (2) |
|
|
306 | (2) |
|
|
308 | (3) |
Index |
|
311 | |