Node.js By Example
eBook - ePub

Node.js By Example

Krasimir Tsonev

Compartir libro
  1. 220 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

Node.js By Example

Krasimir Tsonev

Detalles del libro
Vista previa del libro
Índice
Citas

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Node.js By Example un PDF/ePUB en línea?
Sí, puedes acceder a Node.js By Example de Krasimir Tsonev en formato PDF o ePUB, así como a otros libros populares de Computer Science y Open Source Programming. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2015
ISBN
9781784395711

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...

Índice