About the Author |
|
xv | |
About the Technical Reviewers |
|
xvii | |
Foreword |
|
xix | |
Acknowledgments |
|
xxi | |
Introduction |
|
xxiii | |
Part I: Getting Started |
|
1 | (30) |
|
Chapter 1 Starting with Express.js |
|
|
3 | (12) |
|
|
4 | (3) |
|
|
5 | (1) |
|
|
5 | (1) |
|
|
5 | (1) |
|
Configuring Express.js App Settings |
|
|
6 | (1) |
|
|
6 | (1) |
|
|
6 | (1) |
|
|
6 | (1) |
|
|
7 | (5) |
|
Express.js Generator Installation |
|
|
12 | (2) |
|
|
14 | (1) |
|
Chapter 2 Hello World Example |
|
|
15 | (16) |
|
|
15 | (5) |
|
|
17 | (1) |
|
Outputting Terminal Messages |
|
|
17 | (2) |
|
|
19 | (1) |
|
|
20 | (8) |
|
Generating a Skeleton Express.js app |
|
|
21 | (1) |
|
Reviewing the Application's Structure |
|
|
22 | (6) |
|
MVC Structure and Modules |
|
|
28 | (1) |
|
Watching for File Changes |
|
|
29 | (1) |
|
|
30 | (1) |
Part II: Deep API Reference |
|
31 | (122) |
|
Chapter 3 Configuration, Settings, and Environments |
|
|
33 | (18) |
|
|
33 | (2) |
|
|
34 | (1) |
|
app.enable() and app.disable() |
|
|
34 | (1) |
|
app.enabled() and app.disabled() |
|
|
35 | (1) |
|
|
35 | (10) |
|
|
36 | (1) |
|
|
36 | (1) |
|
|
36 | (2) |
|
|
38 | (1) |
|
|
38 | (1) |
|
|
38 | (2) |
|
json replacer and json spaces |
|
|
40 | (1) |
|
|
41 | (1) |
|
|
42 | (1) |
|
|
42 | (2) |
|
|
44 | (1) |
|
|
45 | (1) |
|
|
45 | (1) |
|
|
45 | (4) |
|
|
49 | (2) |
|
Chapter 4 Working with Middleware |
|
|
51 | (24) |
|
|
52 | (3) |
|
|
55 | (18) |
|
|
56 | (2) |
|
|
58 | (1) |
|
|
59 | (1) |
|
|
60 | (1) |
|
|
61 | (1) |
|
|
62 | (1) |
|
|
62 | (2) |
|
|
64 | (1) |
|
|
64 | (2) |
|
|
66 | (1) |
|
|
66 | (1) |
|
|
67 | (1) |
|
|
68 | (1) |
|
|
69 | (2) |
|
|
71 | (1) |
|
|
72 | (1) |
|
|
73 | (1) |
|
|
73 | (2) |
|
Chapter 5 Template Engines and Consolidate.js |
|
|
75 | (12) |
|
How to Use Template Engines |
|
|
76 | (6) |
|
|
77 | (1) |
|
|
78 | (4) |
|
|
82 | (1) |
|
|
82 | (1) |
|
|
82 | (1) |
|
|
82 | (1) |
|
|
82 | (1) |
|
|
83 | (1) |
|
|
83 | (1) |
|
|
83 | (1) |
|
|
83 | (1) |
|
|
83 | (1) |
|
|
83 | (1) |
|
|
83 | (1) |
|
|
83 | (2) |
|
|
85 | (2) |
|
Chapter 6 Parameters and Routing |
|
|
87 | (16) |
|
|
87 | (7) |
|
|
91 | (3) |
|
|
94 | (6) |
|
|
95 | (3) |
|
|
98 | (1) |
|
|
98 | (1) |
|
|
98 | (1) |
|
|
99 | (1) |
|
|
100 | (2) |
|
|
102 | (1) |
|
Chapter 7 Express.js Request Object |
|
|
103 | (16) |
|
|
104 | (2) |
|
|
106 | (2) |
|
|
108 | (2) |
|
|
110 | (1) |
|
|
111 | (2) |
|
|
113 | (1) |
|
request.header() and request.get() |
|
|
113 | (1) |
|
Other Attributes and Methods |
|
|
113 | (4) |
|
|
117 | (2) |
|
Chapter 8 Express.js Response Object |
|
|
119 | (22) |
|
|
119 | (3) |
|
|
122 | (2) |
|
|
124 | (2) |
|
|
126 | (1) |
|
|
127 | (3) |
|
|
130 | (2) |
|
|
132 | (1) |
|
|
133 | (1) |
|
Other Response Methods and Properties |
|
|
133 | (4) |
|
|
137 | (2) |
|
|
139 | (2) |
|
Chapter 9 Error Handling and Running an App |
|
|
141 | (12) |
|
|
141 | (4) |
|
|
145 | (6) |
|
|
145 | (1) |
|
|
145 | (1) |
|
|
146 | (1) |
|
app.on('mount', function(parent){...}) |
|
|
147 | (1) |
|
|
147 | (1) |
|
|
147 | (4) |
|
|
151 | (2) |
Part III: Solving Common and Abstract Problems |
|
153 | (62) |
|
|
155 | (6) |
|
|
155 | (1) |
|
|
156 | (2) |
|
Combining Middleware and Routes |
|
|
158 | (2) |
|
|
160 | (1) |
|
Chapter 11 Database, Keys and Stream Tips |
|
|
161 | (10) |
|
Using Databases in Modules |
|
|
161 | (2) |
|
|
163 | (2) |
|
|
164 | (1) |
|
|
165 | (1) |
|
|
165 | (5) |
|
|
170 | (1) |
|
Chapter 12 Redis and Authentication Patterns |
|
|
171 | (6) |
|
|
171 | (4) |
|
|
175 | (1) |
|
|
176 | (1) |
|
Chapter 13 Multithreading with Clusters |
|
|
177 | (4) |
|
|
177 | (3) |
|
|
180 | (1) |
|
Chapter 14 Applying Stylus, Less, and Sass |
|
|
181 | (4) |
|
|
181 | (1) |
|
|
182 | (1) |
|
|
183 | (1) |
|
|
183 | (2) |
|
|
185 | (8) |
|
Cross-Site Request Forgery |
|
|
185 | (3) |
|
|
188 | (1) |
|
|
188 | (2) |
|
|
190 | (2) |
|
|
192 | (1) |
|
Chapter 16 Socket.IO and Express.js |
|
|
193 | (6) |
|
|
193 | (4) |
|
|
197 | (1) |
|
|
198 | (1) |
|
Chapter 17 Domain and Express.js |
|
|
199 | (6) |
|
|
199 | (1) |
|
Exploring a Basic Domain Example |
|
|
200 | (1) |
|
|
200 | (4) |
|
|
204 | (1) |
|
Chapter 18 Sails.js, DerbyJS, LoopBack, and Other Frameworks |
|
|
205 | (10) |
|
|
205 | (2) |
|
|
207 | (3) |
|
|
210 | (3) |
|
|
213 | (1) |
|
|
214 | (1) |
Part IV: Tutorials and Examples |
|
215 | (102) |
|
Chapter 19 Instagram Gallery |
|
|
217 | (6) |
|
Starting the Instagram Gallery |
|
|
217 | (4) |
|
|
221 | (1) |
|
|
222 | (1) |
|
|
223 | (26) |
|
|
224 | (5) |
|
|
229 | (2) |
|
|
231 | (6) |
|
|
237 | (4) |
|
|
241 | (6) |
|
|
247 | (1) |
|
|
248 | (1) |
|
|
249 | (14) |
|
|
250 | (1) |
|
|
251 | (5) |
|
|
256 | (1) |
|
|
257 | (4) |
|
|
261 | (2) |
|
|
263 | (54) |
|
|
263 | (1) |
|
|
264 | (7) |
|
|
271 | (1) |
|
|
272 | (1) |
|
|
273 | (5) |
|
|
278 | (24) |
|
|
278 | (1) |
|
|
278 | (5) |
|
|
283 | (3) |
|
|
286 | (6) |
|
|
292 | (3) |
|
|
295 | (7) |
|
|
302 | (8) |
|
|
310 | (5) |
|
|
315 | (2) |
Appendix A: Related Reading and Resources |
|
317 | (4) |
|
|
317 | (2) |
|
|
319 | (1) |
|
|
320 | (1) |
Appendix B: Migrating Express.js 3.x to 4.x: Middleware, Route, and Other Changes |
|
321 | (8) |
|
Introducing Unbundled Middleware in Express.js 4 |
|
|
321 | (2) |
|
Removing Deprecated Methods from Express.js 4 Apps |
|
|
323 | (1) |
|
|
323 | (1) |
|
|
323 | (1) |
|
|
324 | (1) |
|
|
324 | (1) |
|
|
324 | (1) |
|
|
324 | (1) |
|
Other Express.js 4 Changes |
|
|
324 | (1) |
|
|
324 | (1) |
|
|
324 | (1) |
|
|
324 | (1) |
|
|
325 | (1) |
|
|
325 | (1) |
|
|
325 | (1) |
|
|
325 | (1) |
|
Express.js Command-Line Generator |
|
|
325 | (1) |
|
Exploring the New Express.js 4 Route Instance and How to Chain It |
|
|
325 | (2) |
|
Further Express.js 4 Migration Reading Links |
|
|
327 | (2) |
Appendix C: Express.js 4 Cheat Sheet |
|
329 | (6) |
|
|
330 | (1) |
|
|
330 | (1) |
|
|
330 | (1) |
|
|
331 | (1) |
|
|
331 | (1) |
|
|
331 | (1) |
|
|
332 | (1) |
|
|
332 | (1) |
|
|
332 | (1) |
|
|
332 | (1) |
|
|
333 | (1) |
|
|
333 | (1) |
|
|
333 | (2) |
Appendix D: ExpressWorks |
|
335 | (4) |
|
|
335 | (1) |
|
|
336 | (1) |
|
|
336 | (1) |
|
|
336 | (2) |
|
|
336 | (1) |
|
|
336 | (1) |
|
|
337 | (1) |
|
|
337 | (1) |
|
|
337 | (1) |
|
|
337 | (1) |
|
|
338 | (1) |
|
|
338 | (1) |
|
|
338 | (1) |
Index |
|
339 | |