Free Sample
+ Collection

Building Single-page Web Apps with Meteor

Learning
Fabian Vogelsteller

Build real-time apps at lightning speed using the most powerful full-stack JavaScript framework
$14.99
$24.99
RRP $14.99
RRP $24.99
eBook
Print + eBook

Want this title & more?

$16.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781783988129
Paperback198 pages

About This Book

  • Create a complete web blog from frontend to backend that uses only JavaScript
  • Understand how Web 2.0 is made by powerful browser-based applications
  • Step-by-step tutorial that will show you how fast, complex web applications can be built

Who This Book Is For

If you are a web developer with basic knowledge of JavaScript and want to take on Web 2.0, build real-time applications, or simply want to write a complete application using only JavaScript and HTML/CSS, this is the book for you.

This book is based on Meteor 1.0.

Table of Contents

Chapter 1: Getting Started with Meteor
The full-stack framework of Meteor
Meteor's requirements
Installing Meteor
Creating our first app
Adding basic packages
Variable scopes
Meteor's folder conventions and loading order
Meteor's command-line tool
Summary
Chapter 2: Building HTML Templates
Writing templates in Meteor
Building the basic templates
Adding templates and partials
Displaying data with template helpers
Setting the data context for a template
"this" in template helpers and template callbacks
Adding events
Block helpers
Listing posts
Spacebars syntax
Summary
Chapter 3: Storing Data and Handling Collections
Meteor and databases
Setting up a collection
Adding post examples
Querying a collection
Updating a collection
Database everywhere
Differences between client and server collections
Summary
Chapter 4: Controlling the Data Flow
Syncing data – the current Web versus the new Web
Removing the autopublish package
Publishing data
Publishing only parts of data
Publishing specific fields
Lazy loading posts
Switching subscriptions
Some notes on data publishing
Summary
Chapter 5: Making Our App Versatile with Routing
Adding the iron:router package
Setting up the router
Switching to a layout template
Adding another route
Moving the posts subscription to the Home route
Setting up the post route
Changing the website's title
Summary
Chapter 6: Keeping States with Sessions
Meteor's session object
Using sessions in template helpers
Rerunning functions reactively
Using autorun in a template
The reactive session object
Summary
Chapter 7: Users and Permissions
Meteor's accounts packages
Adding the accounts packages
Adding admin functionality to our templates
Creating the template to edit posts
Creating the admin user
Creating routes for the admin
Summary
Chapter 8: Security with the Allow and Deny Rules
Adding a function to generate slugs
Creating a new post
Editing posts
Restricting database updates
Adding a deny rule
Adding posts using a method call
Calling the method
Summary
Chapter 9: Advanced Reactivity
Reactive programming
Building a simple reactive object
Creating an advanced timer object
Reactive computations
Summary
Chapter 10: Deploying Our App
Deploying on meteor.com
Deploying on other servers
Outlook
Summary
Chapter 11: Building Our Own Package
The structure of a package
Creating our own package
Releasing our package to the public
Summary
Chapter 12: Testing in Meteor
Types of tests
Testing packages
Testing our meteor app
Acceptance tests
Summary

What You Will Learn

  • Create reactive templates that update themselves when data changes
  • Use database queries on the client and the server to retrieve, sort, and manipulate datasets
  • Understand data synchronization using a publication/subscription model and make API calls a thing of the past
  • Discover how you can secure your data flow on the server side to keep confidential data secret
  • Add routing to a single-page application and make it appear like a real website
  • Build your own advanced reactive objects and make everything rerun when you want
  • Make your own Meteor packages and learn how to make them public
  • Unit test your packages and Meteor applications

In Detail

Meteor is the best JavaScript platform on the Web that allows you to build real-time web applications quickly and easily and in pure JavaScript. It comes with a full build process that takes care of everything, from development to production, with no need for configuration. This book takes you from the installation of Meteor to building a fully working web blog (including backend) to create and edit posts.

You will start with the basic concepts and folder structure of a Meteor project, learning how Meteor templates work. Learn how to retrieve and send data to the server and manipulate the database content. Routing will later make your example app look and behave like a real website. Next, you'll get to grips with Meteor's reactivity concept that can rerun functions when data changes while you're building your own reactive object, and package it later for drop-in use. After your app is ready, the book continues with ways of deploying your app on different types of servers. Finally, we will take a look at testing packages and the application itself.

Authors

Read More