Node.js By Example
eBook - ePub

Node.js By Example

Krasimir Tsonev

Condividi libro
  1. 220 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Node.js By Example

Krasimir Tsonev

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Node.js By Example è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Node.js By Example di Krasimir Tsonev in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Computer Science e Open Source Programming. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

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

Indice dei contenuti