Node.js Blueprints
eBook - ePub

Node.js Blueprints

  1. 268 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Node.js Blueprints

Book details
Book preview
Table of contents
Citations

About This Book

In Detail

Node.js has emerged as a strong alternative to PHP, and has taken the world of web development by storm. Node.js is a platform that's used to build fast, scalable network applications using JavaScript as a server-side scripting language.

Starting with an overview of the most popular programming paradigms, you will venture out on a journey to the depths of Node.js, utilizing its capabilities to conceptualize and develop applications using AngularJS, Socket.IO, Backbone.js, Ember.js, and Grunt.

Packed with real-world examples and trade secrets gained from years of experience in the web development domain, this book takes you to the next level and teaches you everything you need to know to utilize the astronomical potential of Node.js. As a JavaScript platform, Node.js can also be used for desktop application development, which you will learn about in the final chapter of this book.

Approach

A straightforward, practical guide containing step-by-step tutorials that will push your Node.js programming skills to the next level.

Who this book is for

If you are a web developer with experience in writing client-side JavaScript and want to discover the fascinating world of Node.js to develop fast and efficient web and desktop applications, then this book is for you.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Node.js Blueprints by Krasimir Tsonev in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in JavaScript. We have over one million books available in our catalogue for you to explore.

Information

Year
2014
ISBN
9781783287338
Edition
1

Node.js Blueprints


Table of Contents

Node.js Blueprints
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
Downloading the color images of this book
Errata
Piracy
Questions
1. Common Programming Paradigms
Node.js fundamentals
Organizing your code logic in modules
Building a car construction application
Using the car's engine
Understanding inter-module communication
Asynchronous programming
Exploring middleware architecture
Composition versus inheritance
Managing dependencies
Summary
2. Developing a Basic Site with Node.js and Express
Getting acquainted with Express
Installing Express
Using package.json
Using a command-line tool
Managing routes
Handling dynamic URLs and the HTML forms
Returning a response
The example-logging system
Summary
3. Writing a Blog Application with Node.js and AngularJS
Exploring AngularJS
Bootstrapping AngularJS applications
Using directives and controllers
Data binding
Encapsulating logic with modules
Preparing data with filters
Dependency injection
The model in the context of AngularJS
Final words on AngularJS
Selecting and initializing the database
Using NoSQL with MongoDB
Using MySQL
Developing the client side with Angular
Implementing a control panel
Summary
4. Developing a Chat with Socket.IO
Exploring WebSockets and Socket.IO
Understanding the basic application structure
Running the server
Adding Socket.IO
Writing the client side of the chat
Preparing the HTML markup
Writing the chat logic
Implementing user-to-user communication
Changing the server-side code
Making changes to the frontend of the chat
Summary
5. Creating a To-do Application with Backbone.js
Exploring the Backbone.js framework
Recognizing the framework dependency
Extending the functionality
Understanding Backbone.js as an event-driven framework
Using models
Using collections
Implementing views
Using the router
Talking to the backend
Writing the backend of the application
Running the Node.js server
Managing the to-do lists
Writing the frontend
Looking into the base of the application
Listing the to-do activities
Adding, deleting, and editing the to-do lists
Summary
6. Using Node.js as a Command-line Tool
Exploring the required modules
Planning the application
Obtaining images from a folder
Authorizing the Flickr protocol
Obtaining your application's Key and Secret
Writing into the Flickr.js module
Running our application tool
Uploading the images
Summary
7. Showing a Social Feed with Ember.js
Preparing the application
Running the server and delivering the assets
Getting tweets based on a user handle
Discovering Ember.js
Knowing the dependencies of Ember.js
Understanding Ember.js
Exploring classes and objects in Ember.js
Computed properties
Router
Views and templates
Models
Controllers
Writing Ember.js
Defining the templates
Defining the routes
Handling the user input and moving to the second screen
Displaying the tweets
Summary
8. Developing Web App Workflow with Grunt and Gulp
Introducing the task runners
Exploring Grunt
Concatenating files
Minifying your code
Watching files for changes
Ignoring files
Creating our own task
Generating a cache manifest file
Documenting our code
Discovering Gulp
Installing Gulp and fetching plugins
Concatenating and minifying with Gulp
Creating your own Gulp plugin
Summary
9. Automate Your Testing with Node.js
Understanding the importance of writing tests
Choosing a testing methodology
Test-driven development
Behavior-driven development
Classifying tests
Using Jasmine
Installing Jasmine
Defining the module for testing
Following the test-driven development concept
Testing the file-reading process
Finding strings in the file content
Writing an integration test
Testing with Mocha
Installation
Translating our example using Mocha
Selecting a reporter
Testing with a headless browser
Writing the subject of our test
Testing with PhantomJS
Developing the micro testing framework
Understanding how PhantomJS works
Writing the actual test
Testing with DalekJS
Summary
10. Writing Flexible and Modular CSS
Writing modular CSS
BEM (block, element, modifier)
Using the Object Oriented CSS approach
Separate structure and skin
Separate container and content
Scalable and modular architecture for CSS
Atomic design
Exploring CSS preprocessors
Using Less
Defining variables
Using mixins
Structuring the styles into nested definitions
Using Sass
Using Stylus
Working with AbsurdJS
Styling a simple login form
Summary
11. Writing a REST API
Discovering REST and API
Developing an online library – a REST API
Defining the API parts
Writing the base
Implementing the API router
Writing the responder
Working with the database
Creating a new record
Editing a record
Deleting a record
Displaying all the books
Adding a default route
Testing the API
Summary
12. Developing Desktop Apps with Node.js
Using node-webkit
Writing the base of the application
Writing the package.json file
Preparing the HTML layout
Designing the JavaScript base
Displaying and using the working directory
Displaying the current working directory
Showing the files and folders
Changing the current directory
Copying, moving, and deleting files
Extending the application
Tweaking the updateFileArea function
Loading a new page for the selected image
Showing the image and its dimensions
Removing the toolbar
Summary
Index

Node.js Blueprints

Copyright © 2014 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: June 2014
Production Reference: 1060614
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78328-733-8
www.packtpub.com
Cover Image by Svetlana Mircheva-Tsoneva ()

Credits

Author
Krasimir Tsonev
Reviewers
Ben Sammons
Glenn Antoine
Bojan Bižić
Andrey Kovalenko
Miguel A. Madero
Abhijeet S. Sutar
Leo Hsieh
Commi...

Table of contents

  1. Node.js Blueprints