Get Programming with Node.js
Jonathan Wexler
  • February 2019
  • ISBN 9781617294747
  • 480 pages
  • printed in black & white
pBook available Feb 22, 2019
ePub + Kindle available Mar 1, 2019

Lays out a refreshingly down-to-earth, pragmatic, and clear path that shows you how to navigate your way through Node.js.

From the foreword by Kyle Simpson, Getify

Get Programming with Node.js Get Programming with Node.js teaches you to write server-side code in JavaScript using Node.js. In 37 fast-paced, fun, and practical lessons, you'll discover how to extend your existing JavaScript skills to write back-end code for your web applications.

Table of Contents detailed table of contents

Unit 0: Getting Set Up

Lesson 0 Setting up Node.js and the JavaScript engine

0.1 What you’re going to learn

0.2 Understanding Node.js

0.3 The minimally qualified reader

0.4 Why learn to develop in Node.js?

0.5 Preparing yourself for this book


Lesson 1: Configuring your environment

1.1 Installing Node.js

1.2 Installing a text editor

1.3 Setting up SCM and deployment tools

1.4 Working with the Node.js REPL in terminal


Lesson 2: Running a Node.js application

2.1 Creating a JavaScript file

2.2 Running your JavaScript file with Node.js

2.3 Running Individual JavaScript Commands


Unit 1: Getting Started with Node.js

Lesson 3: Creating a Node.js module

3.1 Creating a Node.js module

3.2 Running npm commands

3.3 Initializing a Node.js application


Lesson 4: Building a simple web server in Node.js

4.1 Understanding web servers

4.2 Initializing the application with npm

4.3 Coding the application

4.4 Running the application


Lesson 5: Handling incoming data

5.1 Reworking your server code

5.2 Analyzing request data

5.3 Adding routes to a web application


Lesson 6: Writing better routes and serving external files

6.1 Serving static files with the fs module

6.2 Serving assets

6.3 Moving your routes to another file


Lesson 7: Capstone: Creating your first web application

7.1 Initializing the application

7.2 Application directory structure

7.3 Creating main.js and router.js

7.4 Creating views

7.5 Adding assets

7.6 Creating routes


Unit 2: Easier web development with Express.js

Lesson 8: Setting up an app with Express.js

8.1 Installing the Express.js package

8.2 Building your first Express.js application

8.3 Working your way around a web framework


Lesson 9: Routing in Express.js

9.1 Building routes with Express.js

9.2 Analyzing Request data

9.3 Using MVC


Lesson 10: Connecting views with templates

10.1 Connecting a templating engine

10.2 Passing data from your controllers

10.3 Setting up partials and layouts


Lesson 11: Configurations and error handling

11.1 Modifying your start script

11.2 Handling errors with Express.js

11.3 Serving static files


Lesson 12: Capstone: Enhancing the Confetti Cuisine site with Express.js

12.1 Initializing the application

12.2 Building the application

12.3 Adding more routes

12.4 Routing to views

12.5 Serving static views

12.6 Passing content to the views

12.7 Handling the errors


Unit 3: Connecting to a database

Lesson 13: Set up a MongoDB database

13.1 Setting up MongoDB

13.2 Running commands in the MongoDB shell

13.3 Connecting MongoDB to your application


Lesson 14: Building Models with Mongoose

14.1 Setting up Mongoose with your Node.js application

14.2 Creating a schema

14.3 Organizing your models


Lesson 15: Connecting Controllers and Models

15.1 Creating a controller for subscribers

15.2 Saving posted data to a model

15.3 Using promises with Mongoose


Lesson 16: Capstone: Saving user subscriptions

16.1 Setting up the database

16.2 Modeling data

16.3 Adding subscriber views and routes


Unit 4: Building a user model

Lesson 17: Improving your data models

17.1 Adding validations on the model

17.2 Testing models in REPL

17.3 Creating model associations

17.4 Populating data from associated models


Lesson 18: Building the user model

18.1 Building the user model

18.2 Adding CRUD methods to your models

18.3 Building the index page

18.4 Cleaning up your actions


Lesson 19: Creating and reading your models

19.1 Building the new user form

19.2 Creating new users from a view

19.3 Reading user data with show


Lesson 20: Updating and deleting your models

20.1 Building the edit user form

20.2 Updating users from a view

20.3 Deleting users with the delete action


Lesson 21:Capstone: Adding CRUD models to Confetti Cuisine

21.1 Getting set up

21.2 Building the models

21.3 Creating the views

21.4 Structuring routes

21.5 Creating controllers


Unit 5: Authenticating user accounts

Lesson 22: Adding sessions and flash messages

22.1 Setting up flash message modules

22.2 Adding flash messages to controller actions


Lesson 23: Building a user login and hashing passwords

23.1 Implementing the user login form

23.2 Hashing passwords

23.3 Adding validation middleware with express-validator


Lesson 24: Adding user authentication

24.1 Implementing Passport.js

24.2 Modifying the create action to use passport registration

24.3 Authenticating users at login


Lesson 25: Capstone: Adding user authentication to Confetti Cuisine

25.1 Getting set up

25.2 Creating a login form

25.3 Adding encryption with Passport.js

25.4 Adding flash messaging

25.5 Adding validation middleware with express-validator

25.6 Adding authentication with Passport.js

25.7 Logging in and out


Unit 6: Building an API

Lesson 26: Adding an API to your application

26.1 Organizing your routes

26.2 Creating an API

26.3 Calling your API from the client


Lesson 27: Acccessing your API from your application

27.1 Applying an API namespace

27.2 Joining courses via modal

27.3 Creating an API endpoint to connect models


Lesson 28: Adding API security

28.1 Simple security

28.2 Adding API tokens

28.3 Using JSON web tokens


Lesson 29: Capstone: Implementing an API

29.1 Restructuring routes

29.2 Adding the courses partial

29.3 Creating the AJAX function

29.4 Adding an API endpoint

29.5 Creating an action to enroll users


Unit 7: Adding chat functionality

Lesson 30: Working with

30.1 Using

30.2 Creating a chat box

30.3 Connecting the server and client


Lesson 31: Saving chat messages

31.1 Connecting messages to users

31.2 Displaying user names in chat

31.3 Creating a message model


Lesson 32: Adding a chat notification indicator

32.1 Broadcasting to all other sockets

32.2 Creating a chat indicator in navigation


Lesson 33: Capstone: Adding a chat feature to Confetti Cuisine

33.1 Installing

33.2 Setting up on the server

33.3 Setting up on the client

33.4 Creating a Message model

33.5 Loading messages on connection

33.6 Setting up the chat icon


Unit 8: Deploying and managing code in production

Lesson 34: Deploying your application

34.1 Preparing for deployment

34.2 Deploying your application

34.3 Setting up your database in production


Lesson 35: Managing in production

35.1 Loading seed data

35.2 Linting

35.3 Debugging your application


Lesson 36: Testing your application

36.1 Basic testing with core modules

36.2 Testing with mocha and chai

36.3 Testing with a database and server


Lesson 37: Capstone: Deploying Confetti Cuisine

37.1 Linting and logging

37.2 Preparing for production

37.3 Deploying to Heroku

37.4 Setting up the database

37.5 Debugging in production


Unit A: Appendixes

Appendix A: JavaScript syntax introduced in ES6

A.1 New in ES6

A.1.1 The let keyword

A.1.2 The const variable

A.1.3 String interpolation

A.1.4 Arrow functions


A.2.1 Running JavaScript in REPL

A.2.2 Using REPL in application development


Appendix B: Logging

B.1 Logging

B.2 Global objects

About the Technology

Node.js delivers the speed and reliability you need for ecommerce, social media, and gaming applications. It comes with thousands of prebuilt packages to help you get started immediately. If you want to use JavaScript on the server, Node.js is your choice.

About the book

Get Programming with Node.js teaches you to build web servers using JavaScript and Node. In this engaging tutorial, you’ll work through eight complete projects, from writing the code for your first web server to adding live chat to a web app. Your hands will stay on the keyboard as you explore the most important aspects of the Node development process, including security, database management, authenticating user accounts, and deploying to production. You’ll especially appreciate the easy-to-follow discussions, illuminating diagrams, and carefully explained code!

What's inside

  • New features from ES2015 and later
  • Writing asynchronous code
  • Creating data models
  • Debugging JavaScript modules

About the reader

Written for front-end web developers with intermediate JavaScript skills.

About the author

Jonathan Wexler is skilled in production-grade, full-stack web development. He’s a senior developer with Bloomberg.

combo $49.99 pBook + eBook + liveBook
eBook $39.99 pdf + ePub + kindle + liveBook

placing your order...

Don't refresh or navigate away from the page.

FREE domestic shipping on three or more pBooks

Will take you from average JavaScript programmer to Node Ninja in less than a week!

Joseph White, Joecasa Consulting

Great step-by-step instructions on how to build a Node.js app using the latest technologies.

Jeremy Lange, Sertifi

The go-to book to learn the intricacies of Node and become productive fast.

Vipul Gupta, Microsoft

An approachable, modern, and enjoyable introduction to Node.js.

Bryce Darling, Advanced Data and Network Solutions