Node Cookbook.pdf

所需积分/C币:16 2017-06-27 22:23:41 4.61MB PDF
收藏 收藏

Node Cookbook.pdf
Node cookbook Copyright C 2012 Packt Publishing All rights reserved No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information First published: July 2012 Production reference:1120712 Published by packt Publishing Ltd 35 Livery Street Birmingham B3 2PB, UK. SBN978-184951-7188 ww. packtpub Cover Image by Asher Wishkerman(a. wishkermanampic de Credits Author Project Coordinator David mark clements Sai amare Reviewers Marc harter Joel T. Johnson Joachim larsen Indexe Rekha nair Acquisition Editor Sarah Cullington Graphics Manu Joseph Lead technical editor Jonathan titmus Production coordinator Shantanu Agade Technical editor Manasi poonthottam Cover Work Shantanu Agade About the Author David Mark clements is a web entrepreneur residing in Northern Ireland. From a very early age he was fascinated with programming and computers he first learned basic on one of the many atari's he had accumulated by the age of nine. david learned JavaScript at the age of 12, moving into Linux administration and PhP as a teenager Now(as a twenty-something) he uses his technical skills in business, providing a variety of services ranging from tailored websites, to complete online strategies, to implementing custom warehouse logistics integrated with e-commerce solutions. Node has become a prominent member of his toolkit due to its versatility and powerful interfacing abilities When he's not tinkering with computers, he's working in a homeless hostel, playing bass with Living Rivers worship team, or spending time with the love of his life, Maxine, and her Husky-Spitz cross, Jessi Many thanks to the Node community, who have caused Node to grow as it has, and Node google group, which has been an immense source of information and inspiration. I cannot conclude without acknowledging Jesus, who makes my life worthwhile and gave me strength to complete this book among all the other commitments, interruptions, and general life events About the reviewers Marc Harter is a Senior Web developer for applied data Consultants in Eau claire WI He is actively involved in the JavaScript community from the browser to the server side. He enjoys studying programming languages and paradigms, obsessively changing his theme and background on ArchLinux, and keeping up with the latest in web development. He has a beautiful wife and two beautiful children Joachim Larsen is interested in making stuff work. His appetite for learning new skills and applying them in new ways has seen him build total-solution systems for computer cafes Wing Active Desktop HTML frontend, Samba backend with save-game propagation, Windows Registry manipulation - including cd key pools for optimizing the use of purchased game inventory, networked-based cD image mounting, and more. Being a restless sort, he took to working offshore, building and installing boxes for getting the most out of satellite-based Internet connections while ensuring a hassle-free experience for the individual users nis focus is on making the user experience faster, and making it faster to make more user experiences-generally, in the context of JavaScript.-rich web applications Heco-hoststhe electronics to small-scale food production. I would like to thank my parents for a very interesting childhood that continues to inspire and inform. I love you guys Joshua holbrook, who hails from the far north, earned a master's degree in Mechanical Engineering at the University of Alaska Fairbanks, where he successfully defended his thesis on The measurement of anisotropic thermal conductivity in snow with needle probes. His original background is in MATLAB and Python but he has since mastered Node. js. He has now moved to sunny California with his bird Korben to work in startups Support files, eBooks, discount offers and more Youmightwanttovisitwww.paCktpub.comforsupportfilesanddownloadsrelatedto your book Did you know that Packt offers eBook versions of every book published, with PDF and ePub filesavailableYoucanupgradetotheeBookversionatwww.Packtpub.comandasaprint book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.comformoredetails Atwww.Packtpub.comyoucanalsoreadacollectionoffreetechnicalarticlessignup for a range of free newsletters and receive exclusive discounts and offers on Packt books and ebooks PACKTLIB Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books Why Subscribe? Fully searchable across every book published by packt Copy and paste, print and bookmark content b on demand and accessible via web browser Free Access for packt account holders IfyouhaveanaccountwithPacktatwww.PacktPub.comyoucanusethistoaccess PacktLib today and view nine entirely free books Simply use your login credentials for immediate access Table of contents Preface Chapter 1: Making a Web Server 5 Introduction Setting up a router 5 Serving static files 10 Caching content in memory for immediate delivery Optimizing performance wlth streaming 19 Securing against filesystem hacking exploits 24 Chapter 2: Exploring the Http object 29 Introduction 29 Processing PosT data 29 Handling file uploads 34 UslngNodeasanhttpclient 40 Implementing download throttling 45 Chapter 3: Working with Data Serialization 51 Introduction Converting an object to Json and back again 51 Converting an object to XML and back again 56 Browser-server transmission via ajax 65 Working with real data: fetching trending tweets Chapter 4: Interfacing with Databases 81 Introduction 81 Writing to a csv file 82 Connecting and sending sQL to a MysQL server 85 StorIng and retrieving data wlth MongoDB 90 Storing and retrieving data with Mongoskin 96 StorIng data to CouchDB wlth Cradle 99 Table of contents Retrieving data from CouchDB with cradle 102 Accessing Couch DB changes stream with Cradle 108 Storing and retrieving data with Redis 111 Implementing Pubsub with Redis 115 Chapter 5: Transcending AjAX: Using Websockets 121 Introduction 121 Creating a WebSocket server 122 Seamless fallbacking with socketio 128 Callbacks over socket io transport 134 Creating a real-time widget 138 Chapter 6: Accelerating development with Express 147 Introduction 147 Generating Express scaffolding 148 Defining and applying environments 152 Dynamic routing 156 Templating in Express 160 cSs engines with Express 169 Initializing and using a session 178 Making an Express web app 187 Chapter 7: Implementing Security, Encryption, and Authentication 209 Introduction 209 Implementing Basic Authentication 210 Cryptographic password hashing 213 Implementing Digest Authentication 218 Setting up an Https web server 224 Preventing cross-site request forgery 227 Chapter 8: Integrating Network Paradigms 237 Introduction 237 Sending email 238 Sending SMS 242 Communicating with TCP 249 Creating an SMTP server 256 Implementing a virtual hosting paradigm 261 Table of contents Chapter 9: Writing your Own Node Modules 269 Introduction 269 Creating a test-driven module APl 270 Writing a functional module mock-up 275 Refactoring from functional to prototypical 279 Extending the module's APl 286 Deploying a module to npm 296 Chapter 10: Taking It Live 301 Introduction 301 Deploying to a server environment 301 Automatic crash recovery 307 Continuous deployment 310 Hosting with a Platform as a service provider 318 Index 323 II

试读 127P Node Cookbook.pdf
限时抽奖 低至0.43元/次
身份认证后 购VIP低至7折
  • GitHub

  • 脉脉勋章

  • 签到新秀

  • 分享王者

关注 私信
Node Cookbook.pdf 16积分/C币 立即下载
Node Cookbook.pdf第1页
Node Cookbook.pdf第2页
Node Cookbook.pdf第3页
Node Cookbook.pdf第4页
Node Cookbook.pdf第5页
Node Cookbook.pdf第6页
Node Cookbook.pdf第7页
Node Cookbook.pdf第8页
Node Cookbook.pdf第9页
Node Cookbook.pdf第10页
Node Cookbook.pdf第11页
Node Cookbook.pdf第12页
Node Cookbook.pdf第13页
Node Cookbook.pdf第14页
Node Cookbook.pdf第15页
Node Cookbook.pdf第16页
Node Cookbook.pdf第17页
Node Cookbook.pdf第18页
Node Cookbook.pdf第19页
Node Cookbook.pdf第20页

试读结束, 可继续阅读

16积分/C币 立即下载