Node.js By Example
eBook - ePub

Node.js By Example

Krasimir Tsonev

Buch teilen
  1. 220 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

Node.js By Example

Krasimir Tsonev

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Node.js By Example als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Node.js By Example von Krasimir Tsonev im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Computer Science & Open Source Programming. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Node.js By Example


Table of Contents

Node.js By Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Node.js Fundamentals
Understanding the Node.js architecture
Installing Node.js
Running Node.js server
Defining and using modules
Managing and distributing packages
Creating a module
Using modules
Updating our module
Introducing built-in modules
Creating a server with the HTTP module
Reading and writing to files
Working with events
Managing child processes
Summary
2. Architecting the Project
Introducing the basic layers of the application
The task runner and building system
Introducing Grunt
Discovering Gulp
Test-driven development
The Model-View-Controller pattern
Introducing the REST API concept
Summary
3. Managing Assets
Serving files with Node.js
CSS preprocessing
Packing client-side JavaScript
Concatenating with Gulp
Modularity in the browser with RequireJS
Moving from Node.js to the browser with Browserify
Delivering HTML templates
Defining the templates in script tags
Loading the template externally
Writing HTML inside the JavaScript
Precompiling templates
Summary
4. Developing the Model-View-Controller Layers
Evolving the current setup
Directory structure
Forming the main server handlers
Implementing the router
Introducing Ractive.js
Constructing the entry point of the application
Defining a controller
Managing our views
Creating a model
Summary
5. Managing Users
Working with the MongoDB database
Installing MongoDB
Running MongoDB
Connecting to the database server
Extending the code from the previous chapter
Updating our base model class
Updating page navigation and routing
Registering a new user
Updating the frontend
Updating the backend API
User authentication with sessions
Managing a user's profile
Summary
6. Adding Friendship Capabilities
Finding friends
Adding the search page
Writing the model
Fetching friends from the database
Marking users as friends
Displaying the linked users on the Profile page
Summary
7. Posting Content
Posting and storing text
Adding a form to post text messages
Introducing the content's model
Updating the controller of the home page
Storing content in the database
Showing the user's feed
Posting files
Summary
8. Creating Pages and Events
Refactoring the API
Adding a form to create pages
Creating a record in the database
Showing the currently added pages
Showing a specific page
Posting a comment to a page
Showing the comments
Managing events attached to a particular page
Summary
9. Tagging, Sharing, and Liking
Selecting friends and sending their IDs to the backend
Storing the tagged users and displaying them in the user's feed
Sharing a post
Liking posts and counting the number of likes
Showing the number of likes
Summary
10. Adding Real-time Chat
Getting to know WebSockets
Bringing Socket.IO to the project
Preparing the UI of the chat area
Exchanging messages between the client and the server
Sending messages to the user's friends only
Customizing the output of the chat
Summary
11. Testing the User Interface
Introducing the basic testing toolset
The testing framework
The assertion library
Runner
Preparing our project to run tests
Running our test with PhantomJS
Testing user registration
Simulating user interaction
Filling and submitting the registration form
Tweaking the code's execution order
Listening to the form-submitted event
Testing with DalekJS
Installing DalekJS
Using the DalekJS API
Summary
Index

Node.js By Example

Copyright © 2015 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: May 2015
Production reference: 1190515
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78439-571-1
www.packtpub.com

Credits

Author
Krasimir Tsonev
Reviewers
Danny Allen
Alex (Shurf) Frenkel
Commissioning Editor
Akram Hussain
Acquisition Editors
Purav Motiwalla
Llewellyn Rozario
Content Development Editor
Shubhangi Dhamgaye
Technical Editor
Mrunal M. Chavan
Copy Editor
Vedangi Narvekar
Project Coordinator
Harshal Ved
Proofreaders
Stephen Copestake
Safis Editing
Indexer
Priya Sane
Production Coordinator
Shantanu N. Zagade
Cover Work
Shantanu N. Zagade

About the Author

Krasimir Tsonev is a coder with over 10 years of experience in web development. The author of Node.js Blueprints, Packt Publishing, he works with a strong focus on quality and usability. Krasimir is interested in delivering cutting-edge applications. He enjoys working in the software industry and has a passion for creating and discovering new and effective digital experiences. Right now, he is working with technologies such as HTML5/CSS3, JavaScript, PHP, and Node.js, but he originally started out as a graphic designer. Later, being a Flash developer, he spent several years using ActionScript3 and frameworks such as RobotLegs. After that, as a freelancer, he continued to deliver full-stack web services for his clients, taking care of the graphic design and frontend and backend programming. Right now, with the rise of mobile application development, Krasimir is enthusiastic about working on responsive applications that target various devices. He currently lives and works in Bulgaria. He graduated from the Technical University of Varna with both a bachelor's and a master's degree in computer science. He loves blogging, writing books, and giving talks on the latest trends in web development.
He has authored Node.js Blueprints, Packt Publishing (https://www.packtpub.com/web-development/nodejs-blueprints).

About the Reviewers

Danny Allen is a full-stack web developer who focuses on usability, user experience, localization, and accessibility issues as the founder and director of the international user experience development consultancy Wonderscore Ltd.
Skilled in a wide range of backend and frontend technologies including Python, Django, JavaScript, Node.js, as well as HTML5/CSS3, his recent work has involved the design and implementation of e-learning and government projects in the United Kingdom.
His portfolio and contact details can be found at http://dannya.uk.
Alex (Shurf) Frenkel has worked in the field of web application development since 1998 (the beginning of PHP 3.X) and has extensive experience in system analysis and project managemen...

Inhaltsverzeichnis