NodeJS – The Complete Guide (incl. MVC, REST APIs, GraphQL)

NodeJS – The Complete Guide (incl. MVC, REST APIs, GraphQL)
NodeJS – The Complete Guide (incl. MVC, REST APIs, GraphQL)
English | MP4 | AVC 1280×720 | AAC 44KHz 2ch | 35.5 Hours | 16.9 GB

Master Node JS, build REST APIs with Node.js, GraphQL APIs, add Authentication, use MongoDB, SQL & much more!

Node.js is probably THE most popular and modern server-side programming language you can dive into these days!

Node.js developers are in high demand and the language is used for everything from traditional web apps with server-side rendered views over REST APIs all the way up to GraphQL APIs and real-time web services. Not to mention its applications in build workflows for projects of all sizes.

This course will teach you all of that! From scratch with zero prior knowledge assumed. Though if you do bring some knowledge, you’ll of course be able to quickly jump into the course modules that are most interesting to you.

Here’s what you’ll learn in this course:

  • Node.js Basics & Basic Core Modules
  • Parsing Requests & Sending Responses
  • Rendering HTML Dynamically (on the Server)
  • Using Express.js
  • Working with Files and generating PDFs on the Server (on-the-fly)
  • File Up- and Download
  • Using the Model-View-Controller (MVC) Pattern
  • Using Node.js with SQL (MySQL) and Sequelize
  • Using Node.js with NoSQL (MongoDB) and Mongoose
  • Working with Sessions & Cookies
  • User Authentication and Authorization
  • Sending E-Mails
  • Validating User Input
  • Data Pagination
  • Handling Payments with Stripe.js
  • Building REST APIs
  • Authentication in REST APIs
  • File Upload in REST APIs
  • Building GraphQL APIs
  • Authentication in GraphQL APIs
  • File Upload in GraphQL APIs
  • Building a Realtime Node.js App with Websockets
  • Automated Testing (Unit Tests)
  • Deploying a Node.js Application
  • And Way More!

Does this look like a lot of content? It certainly is!

This is not a short course but it is the “Complete Guide” on Node.js after all. We’ll dive into a lot of topics and we’ll not just scratch the surface.

We’ll also not just walk through boring theory and some slides. Instead, we’ll build two major projects: An online shop (including checkout + payments) and a blog.

All topics and features of the course will be shown and used in these projects and you’ll therefore learn about them in a realistic environment.

What you’ll learn

  • Work with one of the most in-demand web development programming languages
  • Build modern, fast and scalable server-side web applications with NodeJS, databases like SQL or MongoDB and more
  • Understand the NodeJS ecosystem and build server-side rendered apps, REST APIs and GraphQL APIs
Table of Contents

Introduction
1 Introduction
2 What is Node.js?
3 Installing Node.js and Creating our First App
4 Understanding the Role & Usage of Node.js
5 Course Outline
6 How To Get The Most Out Of The Course
7 Working with the REPL vs Using FIles
8 Using the Attached Source Code

Optional: JavaScript – A Quick Refresher
9 Module Introduction
10 JavaScript in a Nutshell
11 Refreshing the Core Syntax
12 let & const
13 Understanding Arrow Functions
14 Working with Objects, Properties & Methods
15 Arrays & Array Methods
16 Arrays, Objects & Reference Types
17 Understanding Spread & Rest Operators
18 Destructuring
19 Async Code & Promises
20 Template Literals
21 Wrap Up
22 Useful Resources & Links

Understanding the Basics
23 Module Introduction
24 How The Web Works
25 Creating a Node Server
26 The Node Lifecycle & Event Loop
27 Controlling the Node.js Process
28 Understanding Requests
29 Sending Responses
30 Request & Response Headers
31 Routing Requests
32 Redirecting Requests
33 Parsing Request Bodies
34 Understanding Event Driven Code Execution
35 Blocking and Non-Blocking Code
36 Node.js – Looking Behind the Scenes
37 Using the Node Modules System
38 Wrap Up
39 Useful Resources & Links

Improved Development Workflow and Debugging
40 Module Introduction
41 Understanding NPM Scripts
42 Installing 3rd Party Packages
43 Global Features vs Core Modules vs Third-Party Modules
44 Using Nodemon for Autorestarts
45 Global & Local npm Packages
46 Understanding different Error Types
47 Finding & Fixing Syntax Errors
48 Dealing with Runtime Errors
49 Logical Errors
50 Using the Debugger
51 Restarting the Debugger Automatically After Editing our App
52 Debugging Node.js in Visual Studio Code
53 Changing Variables in the Debug Console
54 Wrap Up
55 Useful Resources & Links

Working with Express.js
56 Module Introduction
57 What is Express.js?
58 Installing Express.js
59 Adding Middleware
60 How Middleware Works
61 Express.js – Looking Behind the Scenes
62 Handling Different Routes
63 Parsing Incoming Requests
64 Limiting Middleware Execution to POST Requests
65 Using Express Router
66 Adding a 404 Error Page
67 Filtering Paths
68 Creating HTML Pages
69 Serving HTML Pages
70 Returning a 404 Page
71 Using a Helper Function for Navigation
72 Styling our Pages
73 Serving Files Statically
74 Wrap Up
75 Useful Resources & Links

Working with Dynamic Content & Adding Templating Engines
76 Module Introduction
77 Sharing Data Across Requests & Users
78 Templating Engines – An Overview
79 Installing & Implementing Pug
80 Outputting Dynamic Content
81 Official Pug Docs
82 Converting HTML Files to Pug
83 Adding a Layout
84 Finishing the Pug Template
85 Working with Handlebars
86 Converting our Project to Handlebars
87 Adding the Layout to Handlebars
88 Working with EJS
89 Working on the Layout with Partials
90 Wrap Up
91 Useful Resources & Links

The Model View Controller (MVC)
92 Module Introduction
93 What is the MVC?
94 Adding Controllers
95 Finishing the Controllers
96 Adding a Product Model
97 Storing Data in Files Via the Model
98 Fetching Data from Files Via the Model
99 Refactoring the File Storage Code
100 Wrap Up
101 Useful Resources & Links

Optional: Enhancing the App
102 Module Introduction
103 Creating the Shop Structure
104 Working on the Navigation
105 Registering the Routes
106 Storing Product Data
107 Displaying Product Data
108 Editing & Deleting Products
109 Adding Another Item
110 Useful Resources & Links

Dynamic Routes & Advanced Models
111 Module Introduction
112 Preparations
113 Applied Changes
114 Adding the Product ID to the Path
115 Extracting Dynamic Params
116 Loading Product Detail Data
117 Rendering the Product Detail View
118 Passing Data with POST Requests
119 Adding a Cart Model
120 Using Query Params
121 Pre-Populating the Edit Product Page with Data
122 Linking to the Edit Page
123 Editing the Product Data
124 Adding the Product-Delete Functionality
125 Deleting Cart Items
126 Displaying Cart Items on the Cart Page
127 Deleting Cart Items
128 Fixing a Delete Product Bug
129 Wrap Up
130 Useful Resources & Links

SQL Introduction
131 Module Introduction
132 Choosing a Database
133 NoSQL Introduction
134 Comparing SQL and NoSQL
135 Setting Up MySQL
136 Connecting our App to the SQL Database
137 Basic SQL & Creating a Table
138 Retrieving Data
139 Fetching Products
140 Fetching Products – Time to Practice
141 Inserting Data Into the Database
142 Fetching a Single Product with the “where” Condition
143 Wrap Up
144 Useful Resources & Links

Understanding Sequelize
145 Module Introduction
146 What is Sequelize?
147 Connecting to the Database
148 Defining a Model
149 Syncing JS Definitions to the Database
150 Inserting Data & Creating a Product
151 MUST READ: findById() in Sequelize 5
152 Retrieving Data & Finding Products
153 Getting a Single Product with the “where” Condition
154 Fetching Admin Products
155 Updating Products
156 Deleting Products
157 Creating a User Model
158 Adding a One-To-Many Relationship
159 Creating & Managing a Dummy User
160 Using Magic Association Methods
161 Fetching Related Products
162 One-To-Many & Many-To-Many Relations
163 Creating & Fetching a Cart
164 Adding New Products to the Cart
165 Adding Existing Products & Retrieving Cart Items
166 Deleting Related Items & Deleting Cart Products
167 Adding an Order Model
168 Storing Cartitems as Orderitems
169 Resetting the Cart & Fetching and Outputting Orders
170 Wrap Up
171 Useful Resources & Links

Working with NoSQL & Using MongoDB
172 Module Introduction
173 What is MongoDB?
174 Relations in NoSQL
175 Setting Up MongoDB
176 Installing the MongoDB Driver
177 Creating the Database Connection
178 Finishing the Database Connection
179 Using the Database Connection
180 Creating Products
181 Understanding the MongoDB Compass
182 Fetching All Products
183 Fetching a Single Product
184 Making the “Edit” & “Delete” Buttons Work Again
185 Working on the Product Model to Edit our Product
186 Finishing the “Update Product” Code
187 One Note About Updating Products
188 Deleting Products
189 Fixing the “Add Product” Functionality
190 Creating New Users
191 Storing the User in our Database
192 Working on Cart Items & Orders
193 Adding the “Add to Cart” Functionality
194 Storing Multiple Products in the Cart
195 Displaying the Cart Items
196 Fixing a Bug
197 Deleting Cart Items
198 Adding an Order
199 Adding Relational Order Data
200 Getting Orders
201 Removing Deleted Items From the Cart
202 Wrap Up
203 Useful Resources & Links
204 Two Adjustments (behind the scenes)

Working with Mongoose
205 Module Introduction
206 What is Mongoose?
207 Connecting to the MongoDB Server with Mongoose
208 Creating the Product Schema
209 Saving Data Through Mongoose
210 Fetching All Products
211 Fetching a Single Product
212 Updating Products
213 Deleting Products
214 Adding and Using a User Model
215 Using Relations in Mongoose
216 One Important Thing About Fetching Relations
217 Working on the Shopping Cart
218 Loading the Cart
219 Deleting Cart Items
220 Creating & Getting Orders
221 Storing All Order Related Data
222 Clearing the Cart After Storing an Order
223 Getting & Displaying the Orders
224 Wrap Up
225 Useful Resources & Links

Sessions & Cookies
226 Module Introduction
227 What is a Cookie?
228 The Current Project Status
229 Optional: Creating the Login Form
230 Adding the Request Driven Login Solution
231 Setting a Cookie
232 Manipulating Cookies
233 Configuring Cookies
234 What is a Session?
235 Initializing the Session Middleware
236 Using the Session Middleware
237 Using MongoDB to Store Sessions
238 Sessions & Cookies – A Short Summary
239 Deleting a Cookie
240 Fixing Some Minor Bugs
241 Making “Add to Cart” Work Again
242 Two Tiny Improvements
243 Wrap Up
244 Code Adjustments
245 Useful Resources & Links

Adding Authentication
246 Module Introduction
247 What is Authentication?
248 How is Authentication Implemented?
249 Our Updated Project Status
250 Implementing an Authentication Flow
251 Encrypting Passwords
252 Adding a Tiny Code Improvement
253 Adding the Signin Functionality
254 Working on Route Protection
255 Using Middleware to Protect Routes
256 Understanding CSRF Attacks
257 Using a CSRF Token
258 Adding CSRF Protection
259 Fixing the Order Button
260 Providing User Feedback
261 Optional: Styling Error Messages
262 Finishing the Flash Messages
263 Adding Additional Flash Messages
264 Wrap Up
265 Useful Resources & Links

Sending Emails
266 Module Introduction
267 How Does Sending Emails Work?
268 Using SendGrid
269 Using Nodemailer to Send an Email
270 Potential Limitation for Large Scale Apps
271 Useful Resources & Links

Advanced Authentication
272 Module Introduction
273 Resetting Passwords
274 Implementing the Token Logic
275 Creating the Token
276 Creating the Reset Password Form
277 Adding Logic to Update the Password
278 Why we Need Authorization
279 Adding Authorization
280 Adding Protection to Post Actions
281 Why Editing Fails
282 Wrap Up
283 Useful Resources & Links

Understanding Validation
284 Module Introduction
285 Why Should We Use Validation?
286 How to Validate Input?
287 Setup & Basic Validation
288 Using Validation Error Messages
289 Built-In & Custom Validators
290 More Validators
291 Checking For Field Equality
292 Adding Async Validation
293 Keeping User Input
294 Adding Conditional CSS Classes
295 Adding Validation to Login
296 Sanitizing Data
297 Validating Product Addition
298 Validating Product Editing
299 Wrap Up
300 Useful Resources & Links

Error Handling
301 Module Introduction
302 Types of Errors & Error Handling
303 Analyzing the Error Handling in the Current Project
304 Errors – Some Theory
305 Throwing Errors in Code
306 Returning Error Pages
307 Using the Express.js Error Handling Middleware
308 Updating the App
309 Using the Error Handling Middleware Correctly
310 Status Codes
311 Available Status Codes
312 Wrap Up
313 Useful Resources & Links

File Upload & Download
314 Module Introduction
315 Adding a File Picker to the Frontend
316 Handling Multipart Form Data
317 Handling File Uploads with Multer
318 Configuring Multer to Adjust Filename & Filepath
319 Filtering Files by Mimetype
320 Storing File Data in the Database
321 Remove imageUrl from “Add Product”
322 Serving Images Statically
323 Downloading Files with Authentication
324 Setting File Type Headers
325 Restricting File Access
326 Streaming Data vs Preloading Data
327 Using PDFKit for .pdf Generation
328 Generating .pdf Files with Order Data
329 Deleting Files
330 Fixing Invoice Links
331 Wrap Up
332 Useful Resources & Links

Adding Pagination
333 Module Introduction
334 Adding Pagination Links
335 Retrieving a Chunk of Data
336 Skip & Limit with SQL
337 Preparing Pagination Data on the Server
338 Adding Dynamic Pagination Buttons
339 Re-Using the Pagination Logic & Controls
340 Wrap Up
341 Useful Resources & Links

Understanding Async Requests
342 Module Introduction
343 What are Async Requests?
344 Adding Client Side JS Code
345 The JSON Data Format
346 Sending & Handling Background Requests
347 Manipulating the DOM
348 Useful Resources & Links

Adding Payments
349 Module Introduction
350 How Payments Work
351 Adding a Checkout Page
352 Using Stripe in Your App
353 Useful Resources & Links

Working with REST APIs – The Basics
354 Module Introduction
355 What are REST APIs and why do we use Them?
356 Accessing Data with REST APIs
357 Understanding Routing & HTTP Methods
358 REST APIs – The Core Principles
359 Creating our REST API Project & Implementing the Route Setup
360 Sending Requests & Responses and Working with Postman
361 REST APIs, Clients & CORS Errors
362 Sending POST Requests
363 Wrap Up
364 Useful Resources & Links

Working with REST APIs – The Practical Application
365 Module Introduction
366 REST APIs & The Rest Of The Course
367 Understanding the Frontend Setup
368 Planning the API
369 Fetching Lists of Posts
370 Adding a Create Post Endpoint
371 Adding Server Side Validation
372 Setting Up a Post Model
373 Storing Posts in the Database
374 Static Images & Error Handling
375 Fetching a Single Post
376 Image Names & Windows
377 Uploading Images
378 Updating Posts
379 Deleting Posts
380 Adding Pagination
381 Adding a User Model
382 Adding User Signup Validation
383 Signing Users Up
384 How Does Authentication Work?
385 Starting with User Login
386 Logging In & Creating JSON Web Tokens (JWTs)
387 Using & Validating the Token
388 Adding Auth Middleware to All Routes
389 Connecting Posts & Users
390 Adding Authorization Checks
391 Clearing Post-User Relations
392 Wrap Up
393 Useful Resources & Links

Understanding Async Await in Node.js
394 Module Introduction
395 What is Async Await All About?
396 Transforming “Then Catch” to “Async Await”
397 The User Name is Missing!
398 Wrap Up
399 Useful Resources & Links

Understanding Websockets & Socket.io
400 Module Introduction
401 What Are Websockets & Why Would You Use Them?
402 Websocket Solutions – An Overview
403 Setting Up Socket.io on the Server
404 Establishing a Connection From the Client
405 Identifying Realtime Potential
406 Sharing the IO Instance Across Files
407 Synchronizing POST Additions
408 Fixing a Bug – The Missing Username
409 Updating Posts On All Connected Clients
410 Sorting Correctly
411 Deleting Posts Across Clients
412 Wrap Up
413 Useful Resources & Links

Working with GraphQL
414 Module Introduction
415 What is GraphQL?
416 Understanding the Setup & Writing our First Query
417 Defining a Mutation Schema
418 Adding a Mutation Resolver & GraphiQL
419 Adding Input Validation
420 Handling Errors
421 Connecting the Frontend to the GraphQL API
422 Adding a Login Query & a Resolver
423 Adding Login Functionality
424 Adding a Create Post Mutation
425 Extracting User Data From the Auth Token
426 Sending the “Create Post” Query
427 Fixing a Bug & Adding New Posts Correctly
428 Adding a “Get Post” Query & Resolver
429 Sending “Create Post” and “Get Post” Queries
430 Adding Pagination
431 Uploading Images
432 Fetching the imageUrl
433 Viewing a Single Post
434 Updating Posts
435 Deleting Posts
436 Adding Posts & Pagination
437 Managing the User Status
438 Using Variables
439 Fixing a Pagination Bug
440 Wrap Up
441 Useful Resources & Links

Deploying our App
442 Module Introduction
443 Deploying Different Kinds of Apps
444 Deployment Preparations
445 Using Environment Variables
446 Using Production API Keys
447 Setting Secure Response Headers with Helmet
448 Compressing Assets
449 Setting Up Request Logging
450 More on Logging
451 Setting Up a SSL Server
452 Using a Hosting Provider
453 Understanding the Project & the Git Setup
454 A Deployment Example with Heroku
455 Storing User-generated Files on Heroku
456 Deploying APIs
457 Useful Resources & Links

Testing Node.js Applications
458 Module Introduction
459 What is Testing?
460 Why & How?
461 Setup and Writing a First Test
462 Testing the Auth Middleware
463 Organizing Multiple Tests
464 What Not To Test!
465 Using Stubs
466 Testing Controllers
467 Testing Asynchronous Code
468 Setting up a Testing Database
469 Testing Code With An Active Database
470 Cleaning Up
471 Hooks
472 Testing Code That Requires Authentication
473 Wrap Up & Mastering Tests
474 Useful Resources & Links

Node.js as a Build Tool & Using npm
475 Module Introduction
476 npm & Node.js
477 Using npm
478 Versioning in package.json
479 What is a Build Tool?
480 Using Node.js in Build Processes
481 Useful Resources & Links

Roundup
482 Course Roundup
483 Course Slides
484 Bonus: More Content!