Get Programming with Node.js

Book description

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.



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.



Quotes
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

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

Publisher resources

View/Submit Errata

Table of contents

  1. Copyright
  2. Brief Table of Contents
  3. Table of Contents
  4. Foreword
  5. Preface
  6. Acknowledgments
  7. About this book
  8. About the author
  9. Unit 0. Getting set up
    1. Lesson 0. Setting up Node.js and the JavaScript engine
      1. 0.1. What you’re going to learn
      2. 0.2. Understanding Node.js
      3. 0.3. Why learn to develop in Node.js?
      4. 0.4. Preparing yourself for this book
      5. Summary
    2. Lesson 1. Configuring your environment
      1. 1.1. Installing Node.js
      2. 1.2. Installing a text editor
      3. 1.3. Setting up SCM and deployment tools
      4. 1.4. Working with the Node.js REPL in terminal
      5. Summary
    3. Lesson 2. Running a Node.js application
      1. 2.1. Creating a JavaScript file
      2. 2.2. Running your JavaScript file with Node.js
      3. 2.3. Running individual JavaScript commands
      4. Summary
  10. Unit 1. Getting started with Node.js
    1. Lesson 3. Creating a Node.js module
      1. 3.1. Running npm commands
      2. 3.2. Initializing a Node.js application
      3. Summary
    2. Lesson 4. Building a simple web server in Node.js
      1. 4.1. Understanding web servers
      2. 4.2. Initializing the application with npm
      3. 4.3. Coding the application
      4. 4.4. Running the application
      5. Summary
    3. Lesson 5. Handling incoming data
      1. 5.1. Reworking your server code
      2. 5.2. Analyzing request data
      3. 5.3. Adding routes to a web application
      4. Summary
    4. Lesson 6. Writing better routes and serving external files
      1. 6.1. Serving static files with the fs module
      2. 6.2. Serving assets
      3. 6.3. Moving your routes to another file
      4. Summary
    5. Lesson 7. Capstone: Creating your first web application
      1. 7.1. Initializing the application
      2. 7.2. Understanding application directory structure
      3. 7.3. Creating main.js and router.js
      4. 7.4. Creating views
      5. 7.5. Adding assets
      6. 7.6. Creating routes
      7. Summary
  11. Unit 2. Easier web development with Express.js
    1. Lesson 8. Setting up an app with Express.js
      1. 8.1. Installing the Express.js package
      2. 8.2. Building your first Express.js application
      3. 8.3. Working your way around a web framework
      4. Summary
    2. Lesson 9. Routing in Express.js
      1. 9.1. Building routes with Express.js
      2. 9.2. Analyzing request data
      3. 9.3. Using MVC
      4. Summary
    3. Lesson 10. Connecting views with templates
      1. 10.1. Connecting a templating engine
      2. 10.2. Passing data from your controllers
      3. 10.3. Setting up partials and layouts
      4. Summary
    4. Lesson 11. Configurations and error handling
      1. 11.1. Modifying your start script
      2. 11.2. Handling errors with Express.js
      3. 11.3. Serving static files
      4. Summary
    5. Lesson 12. Capstone: Enhancing the Confetti Cuisine site with Express.js
      1. 12.1. Initializing the application
      2. 12.2. Building the application
      3. 12.3. Adding more routes
      4. 12.4. Routing to views
      5. 12.5. Serving static views
      6. 12.6. Passing content to the views
      7. 12.7. Handling the errors
      8. Summary
  12. Unit 3. Connecting to a database
    1. Lesson 13. Setting up a MongoDB Database
      1. 13.1. Setting up MongoDB
      2. 13.2. Running commands in the MongoDB shell
      3. 13.3. Connecting MongoDB to your application
      4. Summary
    2. Lesson 14. Building models with Mongoose
      1. 14.1. Setting up Mongoose with your Node.js application
      2. 14.2. Creating a schema
      3. 14.3. Organizing your models
      4. Summary
    3. Lesson 15. Connecting Controllers and Models
      1. 15.1. Creating a controller for subscribers
      2. 15.2. Saving posted data to a model
      3. 15.3. Using promises with Mongoose
      4. Summary
    4. Lesson 16. Capstone: Saving user subscriptions
      1. 16.1. Setting up the database
      2. 16.2. Modeling data
      3. 16.3. Adding subscriber views and routes
      4. Summary
  13. Unit 4. Building a user model
    1. Lesson 17. Improving Your Data Models
      1. 17.1. Adding validations on the model
      2. 17.2. Testing models in REPL
      3. 17.3. Creating model associations
      4. 17.4. Populating data from associated models
      5. Summary
    2. Lesson 18. Building the user model
      1. 18.1. Building the user model
      2. 18.2. Adding CRUD methods to your models
      3. 18.3. Building the index page
      4. 18.4. Cleaning up your actions
      5. Summary
    3. Lesson 19. Creating and reading your models
      1. 19.1. Building the new user form
      2. 19.2. Creating new users from a view
      3. 19.3. Reading user data with show
      4. Summary
    4. Lesson 20. Updating and Deleting your Models
      1. 20.1. Building the edit user form
      2. 20.2. Updating users from a view
      3. 20.3. Deleting users with the delete action
      4. Summary
    5. Lesson 21. Capstone: Adding CRUD Models to Confetti Cuisine
      1. 21.1. Getting set up
      2. 21.2. Building the models
      3. 21.3. Creating the views
      4. 21.4. Structuring routes
      5. 21.5. Creating controllers
      6. Summary
  14. Unit 5. Authenticating user accounts
    1. Lesson 22. Adding sessions and flash messages
      1. 22.1. Setting up flash message modules
      2. 22.2. Adding flash messages to controller actions
      3. Summary
    2. Lesson 23. Building a user login and hashing passwords
      1. 23.1. Implementing the user login form
      2. 23.2. Hashing passwords
      3. 23.3. Adding validation middleware with express-validator
      4. Summary
    3. Lesson 24. Adding User Authentication
      1. 24.1. Implementing Passport.js
      2. 24.2. Modifying the create action to use passport registration
      3. 24.3. Authenticating users at login
      4. Summary
    4. Lesson 25. Capstone: Adding User Authentication to Confetti Cuisine
      1. 25.1. Getting set up
      2. 25.2. Creating a login form
      3. 25.3. Adding encryption with Passport.js
      4. 25.4. Adding flash messaging
      5. 25.5. Adding validation middleware with express-validator
      6. 25.6. Adding authentication with Passport.js
      7. 25.7. Logging in and out
      8. Summary
  15. Unit 6. Building an API
    1. Lesson 26. Adding an API to Your Application
      1. 26.1. Organizing your routes
      2. 26.2. Creating an API
      3. 26.3. Calling your API from the client
      4. Summary
    2. Lesson 27. Accessing Your API from Your Application
      1. 27.1. Applying an API namespace
      2. 27.2. Joining courses via modal
      3. 27.3. Creating an API endpoint to connect models
      4. Summary
    3. Lesson 28. Adding API Security
      1. 28.1. Implementing simple security
      2. 28.2. Adding API tokens
      3. 28.3. Using JSON web tokens
      4. Summary
    4. Lesson 29. Capstone: Implementing an API
      1. 29.1. Restructuring routes
      2. 29.2. Adding the courses partial
      3. 29.3. Creating the AJAX function
      4. 29.4. Adding an API endpoint
      5. 29.5. Creating an action to enroll users
      6. Summary
  16. Unit 7. Adding chat functionality
    1. Lesson 30. Working with Socket.Io
      1. 30.1. Using socket.io
      2. 30.2. Creating a chat box
      3. 30.3. Connecting the server and client
      4. Summary
    2. Lesson 31. Saving Chat Messages
      1. 31.1. Connecting messages to users
      2. 31.2. Displaying user names in chat
      3. 31.3. Creating a message model
      4. Summary
    3. Lesson 32. Adding a Chat Notification Indicator
      1. 32.1. Broadcasting to all other sockets
      2. 32.2. Creating a chat indicator in navigation
      3. Summary
    4. Lesson 33. Capstone: Adding a Chat Feature to Confetti Cuisinex
      1. 33.1. Installing socket.io
      2. 33.2. Setting up socket.io on the server
      3. 33.3. Setting up socket.io on the client
      4. 33.4. Creating a Message model
      5. 33.5. Loading messages on connection
      6. 33.6. Setting up the chat icon
      7. Summary
  17. Unit 8. Deploying and managing code in production
    1. Lesson 34. Deploying your application
      1. 34.1. Preparing for deployment
      2. 34.2. Deploying your application
      3. 34.3. Setting up your database in production
      4. Summary
    2. Lesson 35. Managing in production
      1. 35.1. Loading seed data
      2. 35.2. Linting
      3. 35.3. Debugging your application
      4. Summary
    3. Lesson 36. Testing your application
      1. 36.1. Basic testing with core modules
      2. 36.2. Testing with mocha and chai
      3. 36.3. Testing with a database and server
      4. Summary
    4. Lesson 37. Capstone: Deploying Confetti Cuisine
      1. 37.1. Linting and logging
      2. 37.2. Preparing for production
      3. 37.3. Deploying to Heroku
      4. 37.4. Setting up the database
      5. 37.5. Debugging in production
      6. Summary
  18. Appendix A. JavaScript syntax introduced in ES6
    1. A.1. New in ES6
    2. A.2. REPL
    3. Summary
  19. Appendix B. Logging and using Node.js global objects
    1. B.1. Logging
    2. B.2. Global objects
  20. Index
  21. List of Figures
  22. List of Tables
  23. List of Listings

Product information

  • Title: Get Programming with Node.js
  • Author(s): Jon Wexler
  • Release date: April 2019
  • Publisher(s): Manning Publications
  • ISBN: 9781617294747