Oreilly.Node.for.Front_End.Developers.Jan.2012.pdf
(
5232 KB
)
Pobierz
Download from Wow! eBook <www.wowebook.com>
Node for Front-End Developers
Garann Means
Beijing
Cambridge
Farnham
Köln
Sebastopol
Tokyo
•
•
•
•
•
Node for Front-End Developers
by Garann Means
Copyright © 2012 Garann Means. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (
http://my.safaribooksonline.com
)
. For more information, contact our
corporate/institutional sales department: (800) 998-9938 or
corporate@oreilly.com
.
Editor:
Simon St. Laurent
Production Editor:
Kristen Borg
Proofreader:
O’Reilly Production Services
Cover Designer:
Karen Montgomery
Interior Designer:
David Futato
Illustrator:
Robert Romano
Revision History for the First Edition:
2012-01-25 First release
See
http://oreilly.com/catalog/errata.csp?isbn=9781449318833
for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc.
Node for Front-End Developers
, the image of a trunkfish, and related trade dress
are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and author assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.
ISBN: 978-1-449-31883-3
[LSI]
1327419629
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v
1.
Getting Node Set Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Node and NPM
1
REPL
2
File Organization
3
2.
Serving Simple Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Writing a Response Manually
5
Serving a Static Page
6
Serving Client-Side Assets
8
Adding In Middleware
10
3.
Interaction with the Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Receiving Data from the Querystring
13
Routing and Receiving Data from a Path
14
Receiving Data from a POST
15
Responding to Asynchronous Requests
16
Real-Time Communication
17
4.
Server-Side Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Creating a Dynamic Page
21
Partial Templates
24
Parsing Other File Types
26
Creating Files on the Fly
27
5.
Data Sources and Flow Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Connecting to a Database
29
Storing Data in Files
32
Callbacks and Messaging
33
iii
Plik z chomika:
agentpl
Inne pliki z tego folderu:
O'Reilly - DNS on Windows Server 2003.chm
(2758 KB)
O'Reilly - Dreamweaver in a Nutshell.chm
(3750 KB)
O'Reilly - Dreamweaver MX 2004 The Missing Manual.chm
(15236 KB)
O'Reilly - Dynamic HTML The Definitive Reference.pdf
(9442 KB)
O'Reilly - eBay Hacks 100 Industrial Strength Tips and Tools.chm
(3279 KB)
Inne foldery tego chomika:
Addison Wesley
Packt Books
Wiley
Zgłoś jeśli
naruszono regulamin