Home Page Icon
Home Page
Table of Contents for
Table of Contents
Close
Table of Contents
by Ben Augarten, Marc Kuo, Eric Lin, Aidha Shaikh, Fabiano Pereira Soriani, Geoffre
Express.js Blueprints
Express.js Blueprints
Table of Contents
Express.js Blueprints
Credits
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
Local user authentication
User object modeling
Introducing Express middleware
Setting up passport
Registering users
Authenticating users
OAuth with passport
Adding OAuth to user model
Getting API tokens
Third-party registration and login
Profile pages
URL params
Profile templates
Testing
Introducing Mocha
Testing API endpoints
Summary
Responding to CRUD operations
Retrieving an actor with GET
Creating a new actor with POST
Updating an actor with PUT
Removing an actor with DELETE
Object modeling with Mongoose
Validating your database
Extracting functions to reusable middleware
Testing
Summary
3. Multiplayer Game API – Connect 4
Modeling game state with Mongoose
Creating a new game
Input validation
Getting the game state
Joining a game
Playing the game
Testing for a tie
Summary
4. MMO Word Game
Gameplay
Real-time application overview
Keeping track of active users
Schema design
User schema
User join
Promises
The then and catch method
Chain multiple Promises
Prevent duplicates
User leaves the game
Show all active users
The words – Subdocuments
Validate input
Dealing with race conditions
Test case to test race conditions
Socket.IO
Socket handshaking, user join
Adding and pushing updates to clients
Launch Socket.IO applications
Test Socket.IO applications with the Socket.IO client
Debug Socket.IO with Chrome Developer Tools
Summary
Defining routes
Persisting data
Exception handling
Naive pairing
Notes about tests
Considering user history
Optimizing for distance
E-mail follow up
Periodical tasks with node-cron
Summary
6. Hacker News API on Koa.js
Generator syntax
Middleware philosophy
Context versus req,res
The link model
The link routes
Tying it together
Validation and error handling
Update route
Let's perform some tests
Parallel requests
Rendering HTML pages
Serving static assets
Summary
A. Connect 4 – Game Logic
Index
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Cover
Next
Next Chapter
Express.js Blueprints
Table of Contents
Express.js Blueprints
Credits
About the Authors
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. Building a Basic Express Site
Setting up Express for a static site
Saying Hello, World in Express
Jade templating
Local user authentication
User object modeling
Introducing Express middleware
Setting up passport
Registering users
Authenticating users
OAuth with passport
Adding OAuth to user model
Getting API tokens
Third-party registration and login
Profile pages
URL params
Profile templates
Testing
Introducing Mocha
Testing API endpoints
Automate builds and deploys
Introducing the Gruntfile
Continuous integration with Travis
Deploying Node.js applications
Summary
2. A Robust Movie API
Folder structure and organization
Responding to CRUD operations
Retrieving an actor with GET
Creating a new actor with POST
Updating an actor with PUT
Removing an actor with DELETE
Object modeling with Mongoose
Generating unique IDs
Validating your database
Extracting functions to reusable middleware
Testing
Summary
3. Multiplayer Game API – Connect 4
Modeling game state with Mongoose
Creating a new game
Input validation
Getting the game state
Joining a game
Playing the game
Testing for a tie
Summary
4. MMO Word Game
Gameplay
Real-time application overview
Keeping track of active users
Schema design
User schema
User join
Promises
The then and catch method
Chain multiple Promises
Prevent duplicates
User leaves the game
Show all active users
The words – Subdocuments
Validate input
Dealing with race conditions
Test case to test race conditions
Socket.IO
Socket handshaking, user join
Adding and pushing updates to clients
Launch Socket.IO applications
Test Socket.IO applications with the Socket.IO client
Debug Socket.IO with Chrome Developer Tools
Summary
5. Coffee with Strangers
Code structure
Defining routes
Persisting data
Exception handling
Naive pairing
Notes about tests
Considering user history
Optimizing for distance
E-mail follow up
Periodical tasks with node-cron
Summary
6. Hacker News API on Koa.js
Generator syntax
Middleware philosophy
Context versus req,res
The link model
The link routes
Tying it together
Validation and error handling
Update route
Let's perform some tests
Parallel requests
Rendering HTML pages
Serving static assets
Summary
A. Connect 4 – Game Logic
Index
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset