Express.js Blueprints

Learn to use Express.js pragmatically by creating five fun and robust real-world APIs, with a bonus chapter on Koa.js

Express.js Blueprints

This ebook is included in a Mapt subscription
Ben Augarten et al.

Learn to use Express.js pragmatically by creating five fun and robust real-world APIs, with a bonus chapter on Koa.js
$10.00
$29.99
RRP $23.99
RRP $29.99
eBook
Print + eBook
Access every Packt eBook & Video for just $100
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Find Out More
 
Preview in Mapt

Book Details

ISBN 139781783983025
Paperback198 pages

Book Description

APIs are at the core of every serious web application. Express.js is the most popular framework for building on top of Node.js, an exciting tool that is easy to use and allows you to build APIs and develop your backend in JavaScript. Express.js Blueprints consists of many well-crafted tutorials that will teach you how to build robust APIs using Express.js.

The book covers various different types of applications, each with a diverse set of challenges. You will start with the basics such as hosting static content and user authentication and work your way up to creating real-time, multiplayer online games using a combination of HTTP and Socket.IO. Next, you'll learn the principles of SOA in Node.js and see them used to build a pairing as a service. If that's not enough, we'll build a CRUD backend to post links and upvote with Koa.js!

Table of Contents

Chapter 1: Building a Basic Express Site
Setting up Express for a static site
Local user authentication
OAuth with passport
Profile pages
Testing
Automate builds and deploys
Summary
Chapter 2: A Robust Movie API
Folder structure and organization
Responding to CRUD operations
Object modeling with Mongoose
Generating unique IDs
Validating your database
Extracting functions to reusable middleware
Testing
Summary
Chapter 3: Multiplayer Game API – Connect 4
Modeling game state with Mongoose
Creating a new game
Summary
Chapter 4: MMO Word Game
Gameplay
Schema design
Promises
Socket.IO
Summary
Chapter 5: Coffee with Strangers
Code structure
Defining routes
Persisting data
Naive pairing
Considering user history
Optimizing for distance
E-mail follow up
Periodical tasks with node-cron
Summary
Chapter 6: Hacker News API on Koa.js
Generator syntax
Validation and error handling
Update route
Let's perform some tests
Summary

What You Will Learn

  • Set up the Express.js framework with a basic scaffold
  • Model data using Mongoose and build a CRUD API to store the data in a database
  • Use promises to avoid callback hell in Node.js
  • Address scalability concerns and deal with race conditions
  • Apply test-driven development (TDD) by using Mocha to write tests for your apps
  • Get familiar with service-oriented architecture (SOA)
  • Integrate Socket.IO and dynamically push updates to the client
  • Write Node.js APIs by leveraging generator functions using Koa.js

Authors

Table of Contents

Chapter 1: Building a Basic Express Site
Setting up Express for a static site
Local user authentication
OAuth with passport
Profile pages
Testing
Automate builds and deploys
Summary
Chapter 2: A Robust Movie API
Folder structure and organization
Responding to CRUD operations
Object modeling with Mongoose
Generating unique IDs
Validating your database
Extracting functions to reusable middleware
Testing
Summary
Chapter 3: Multiplayer Game API – Connect 4
Modeling game state with Mongoose
Creating a new game
Summary
Chapter 4: MMO Word Game
Gameplay
Schema design
Promises
Socket.IO
Summary
Chapter 5: Coffee with Strangers
Code structure
Defining routes
Persisting data
Naive pairing
Considering user history
Optimizing for distance
E-mail follow up
Periodical tasks with node-cron
Summary
Chapter 6: Hacker News API on Koa.js
Generator syntax
Validation and error handling
Update route
Let's perform some tests
Summary

Book Details

ISBN 139781783983025
Paperback198 pages
Read More

Read More Reviews