Learn to make more efficient apps, with just one language!
Smashing Node.js: JavaScript Everywhere equips you with the necessary tools to understand Node.js and its uses in developing efficient web apps. With more traditional web servers becoming obsolete, having knowledge on servers that achieve high scalability and optimal resource consumption using Node.js is the key to your app development success. Teaching you the essentials to making event-driven server-side apps, this book demonstrates how you can use less space and take less time for communication between web client and server.
* Contains numerous hands-on examples
* Explains implementation of real-time apps including Socket.IO and HTML5, and WebSockets
* Addresses practical Node.js advantages from specific design choices
* Demonstrates why knowledge and use of JavaScript is beneficial
* Includes an interactive online component with sample chapters
* Explains components of stand out apps including brevity and benchmarks
Looking to enhance your abilities even further? Smashing Node.js: JavaScript Everywhere makes developing server-side apps accessible with its focus on JavaScript, open source, and easy-to-use language.
Author(s): Guillermo Rauch
Series: Smashing Magazine books
Edition: 2
Publisher: Wiley
Year: 2012
Language: English
Pages: 320
Tags: Библиотека;Компьютерная литература;Node.js;
Smashing Node.js: JavaScript Everywhere......Page 1
CONTENTS......Page 6
FOREWORD......Page 13
INTRODUCTION......Page 15
APPROACH......Page 16
RESOURCES......Page 17
PART I: GETTING STARTED: SETUP AND CONCEPTS......Page 19
CHAPTER 1: THE SETUP......Page 21
INSTALLING ON LINUX......Page 22
THE NODE REPL......Page 23
NPM......Page 24
SUMMARY......Page 28
INTRODUCTION......Page 29
BASIC JAVASCRIPT......Page 30
V8 JAVASCRIPT......Page 36
SUMMARY......Page 40
CHAPTER 3: BLOCKING AND NON-BLOCKING IO......Page 41
WITH GREAT POWER COMES GREAT RESPONSIBILITY......Page 42
SUMMARY......Page 51
CHAPTER 4: NODE JAVASCRIPT......Page 53
THE GLOBAL OBJECT......Page 54
THE MODULE SYSTEM......Page 55
EXPOSING APIS......Page 58
EVENTS......Page 59
BUFFERS......Page 61
SUMMARY......Page 62
PART II: ESSENTIAL NODE APIS......Page 63
CHAPTER 5: CLI AND FS APIS: YOUR FIRST APPLICATION......Page 65
WRITING YOUR FIRST PROGRAM......Page 66
EXPLORING THE CLI......Page 77
EXPLORING THE FS MODULE......Page 80
SUMMARY......Page 82
CHAPTER 6: TCP......Page 83
WHAT ARE THE CHARACTERISTICS OF TCP?......Page 84
TELNET......Page 85
A TCP CHAT PROGRAM......Page 88
AN IRC CLIENT PROGRAM......Page 97
SUMMARY......Page 99
CHAPTER 7: HTTP......Page 101
THE STRUCTURE OF HTTP......Page 102
HEADERS......Page 103
CONNECTIONS......Page 107
A SIMPLE WEB SERVER......Page 108
A TWITTER WEB CLIENT......Page 118
A SUPERAGENT TO THE RESCUE......Page 124
RELOADING HTTP SERVERS WITH UP......Page 125
SUMMARY......Page 126
PART III: WEB DEVELOPMENT......Page 127
CHAPTER 8: CONNECT......Page 129
A SIMPLE WEBSITE WITH HTTP......Page 130
A SIMPLE WEBSITE WITH CONNECT......Page 133
MIDDLEWARE......Page 135
SUMMARY......Page 158
CHAPTER 9: EXPRESS......Page 159
A SIMPLE EXPRESS APP......Page 160
SETTINGS......Page 167
TEMPLATE ENGINES......Page 168
CONVENIENCE METHODS......Page 169
ROUTES......Page 171
MIDDLEWARE......Page 173
ORGANIZATION STRATEGIES......Page 174
SUMMARY......Page 176
CHAPTER 10: WEBSOCKET......Page 177
AJAX......Page 178
HTML5 WEBSOCKET......Page 180
AN ECHO EXAMPLE......Page 181
MOUSE CURSORS......Page 185
THE CHALLENGES AHEAD......Page 191
SUMMARY......Page 192
CHAPTER 11: SOCKET.IO......Page 193
TRANSPORTS......Page 194
A CHAT PROGRAM......Page 196
A DJ-BY-TURNS APPLICATION......Page 205
SUMMARY......Page 215
PART IV: DATABASES......Page 217
CHAPTER 12: MONGODB......Page 219
INSTALLATION......Page 221
ACCESSING MONGODB: A USER AUTHENTICATION EXAMPLE......Page 222
INTRODUCING MONGOOSE......Page 234
A MONGOOSE EXAMPLE......Page 240
SUMMARY......Page 243
CHAPTER 13: MYSQL......Page 245
NODE-MYSQL......Page 246
SEQUELIZE......Page 258
SUMMARY......Page 271
CHAPTER 14: REDIS......Page 273
THE REDIS QUERY LANGUAGE......Page 275
DATA TYPES......Page 276
REDIS AND NODE......Page 280
SUMMARY......Page 290
PART V: TESTING......Page 291
CHAPTER 15: CODE SHARING......Page 293
WRITING COMPATIBLE JAVASCRIPT......Page 294
PUTTING IT ALL TOGETHER: BROWSERBUILD......Page 299
SUMMARY......Page 302
CHAPTER 16: TESTING......Page 303
SIMPLE TESTING......Page 304
EXPECT.JS......Page 306
MOCHA......Page 308
SUMMARY......Page 314
INDEX......Page 315