MANNING
Mike Cantelon
Marc Harter
T.J. Holowaychuk
Nathan Rajlich
FOREWORD BY Isaac Z. Schlueter
Node.js in Action
MIKE CANTELON
MARC HARTER
T.J. HOLOWAYCHUK
NATHAN RAJLICH
MANNING
SHELTER ISLAND
Download from Wow! eBook <www.wowebook.com>
For online information and ordering of this and other Manning books, please visit
www.manning.com. The publisher offers discounts on this book when ordered in quantity.
For more information, please contact
Special Sales Department
Manning Publications Co.
20 Baldwin Road
PO Box 261
Shelter Island, NY 11964
Email: orders@manning.com
©2014 by Manning Publications Co. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in
any form or by means electronic, mechanical, photocopying, or otherwise, without prior written
permission of the publisher.
Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in the book, and Manning
Publications was aware of a trademark claim, the designations have been printed in initial caps
or all caps.
Recognizing the importance of preserving what has been written, it is Manning’s policy to have
the books we publish printed on acid-free paper, and we exert our best efforts to that end.
Recognizing also our responsibility to conserve the resources of our planet, Manning books
are printed on paper that is at least 15 percent recycled and processed without the use of
elemental chlorine.
Manning Publications Co. Development editor: Renae Gregoire
20 Baldwin Road Copyeditor: Andy Carroll
PO Box 261 Proofreader: Katie Tennant
Shelter Island, NY 11964 Typesetter: Dottie Marsico
Cover designer: Marija Tudor
ISBN 9781617290572
Printed in the United States of America
1 2 3 4 5 6 7 8 9 10 – MAL – 18 17 16 15 14 13
Download from Wow! eBook <www.wowebook.com>
iii
brief contents
PART 1 NODE FUNDAMENTALS...................................................1
1
■
Welcome to Node.js 3
2
■
Building a multiroom chat application 14
3
■
Node programming fundamentals 37
PART 2 WEB APPLICATION DEVELOPMENT WITH NODE .............69
4
■
Building Node web applications 71
5
■
Storing Node application data 97
6
■
Connect 123
7
■
Connect’s built-in middleware 145
8
■
Express 176
9
■
Advanced Express 202
10
■
Testing Node applications 242
11
■
Web application templating 264
PART 3 GOING FURTHER WITH NODE ....................................293
12
■
Deploying Node applications and maintaining uptime 295
13
■
Beyond web servers 309
14
■
The Node ecosystem 343
Download from Wow! eBook <www.wowebook.com>
Download from Wow! eBook <www.wowebook.com>