Skip to content

Node — The Complete Guide (MVC, REST APIs, GraphQL, Deno, & more)

Notifications You must be signed in to change notification settings

jubrito/nodejs-udemy-jubrito

Repository files navigation

Node JS & Deno.js — REST APIs, GraphQL APIs, Authentication, MongoDB, SQL & more!

Course/App Content   |    Technologies

Node app (Root)

Store — Demo package.json

REST API + Graphql (Studies folter > 28-Node_Graphql folder) Blog — Demo

package.json (web) package.json (server)

📂 COURSE CONTENT

All the course content can be found at Studies folder

1. Node Basic How the web works, Creating a Node Server, Node Lifecycle & event loop, Requests, Responses & Responses headers, Routing/redirecting requests, Request body parsing, Event Driven code execution, Blocking/Non-blocking code, Node Modules system.
2. Node MVC Software Design Pattern

2.1 Improved Development Workflow and Debugging: NPM Scripts, 3rd party packages vs Global features vs Core modules, Nodemon, Error Types, Syntax & Runtime & Logical errors.

2.2 Express.js: Middlewares, Handling different routes, Parsing incoming requests, Express router, 404 error pages, Paths filtering, Serving files statically, Navigation.

2.3 Dynamic Content & Template Engines: Views, Sharing data across requests & users, Pug/Express Handlebars/Ejs Template Engines.

2.4 Model View Controller (MVC): Controllers, Storing/fetching data through models.

2.5 Enhancing the App: Navigation, Routes and Data Storage.

2.6 Dynamic Routes & Advanced Models: Extracting dynamic params, Using IDs on paths, Passing data on requests, Query Params, HTTP Methods.

3. Node SQL & NoSQL

3.1 SQL: Choosing databases, SQL vs NoSQL, SQL for retrieving data & fetching products

3.2 Sequelize: Synching JS Definitions to the database, inserting data, Model creation, One-To-Many relationships, Managing users and models.

3.3 NoSQL & MongoDB: Relations in NoSQL, Database connections, MongoDB Compass, Storing users, Relational data.

3.4 Mongoose: MongoDB Server connection with Mongoose, Schemas, Saving data though Mongoose, Fetching Relations, Clearing data.

4. Session and Cookies

4.1 Cookies: Request Driven Login Solutions, Setting/manipulating/configuring/deleting cookies.

4.2 Sessions: Session Middlewares, Using MongoDB to store sessions, Connecting Sessions and Cookies.

5. Authentication

5.1 Basic Authentication: Authentication Flow, Encrypting passwords, Sign up/Sign in, Route protection, CSRF Attacks, Tokens and Protection, Providing user feedback, Flash messages.

5.2 Advanced Authentiction: Resetting passwords, Token logic, Updating passwords, Protection to Post Actions, Limiting editing to posts that user created.

6. Emails

6.1 Nodemailer: Sending emails using Nodemailer and SendGrid, Understanding limitations for large scale apps

7. Validation

Basic and custom validation, Validating Errors and Login, Checking for field equality, Async validation, Conditional CSS classes, Sanitazing Data, Validating product manipulation (adding/editing).

8. Error Handling

Type of errors, Throwing errors, Returning error pages,Express.js Error handling middleware, Status Codes

9. File Upload & Download

File Picker, Handling multipart form data, Handling file uploads with multer, Adjusting filename & filepaths, Filtering files by mimetype, Storing file data in the database, Serving images statically, Downloading files with Authentication, Setting file Type headers, Restricting file access, Streaming Data vs Preloading Data, PDFKit for pdf generation, Deleting files.

10. Pagination

Retrieving chunk of data, Skip & Limit with SQL, Preparing pagination data on the server, Dynamic pagination buttons, Re-using pagination logic & controls.

11. Async Requests

Client Side JS Code, JSON Data Format, Sending & Handling background requests, Manipulating the DOM.

12. Payments

How payments work, checkout page, Using Stripe to enable payment.

13. REST APIs

13.1 Basics: Why to use REST APIs, Accessing data, Routing & HTTP Methods, Route setups, Sending requests & responses and working with Postman, Clients & CORS errors, HTTP Methods.

13.2 Practical Application: Frontend setup, Planning the API, Fetching lists of posts, Endpoints creation, Server side validation, Storing posts, Static Images & Error Handling, Image names & windows, HTTP Methods, Signup validation, Logging in & Creating JSON Web Tokens (JWTs), Validating Tokens, Adding Auth Middleware to all routes, COnnecting Posts & Users, Authorization checks, Clearing relations.

14. Async/Await

Transforming Then/Catch into Async/Await, Top-level await

15. Websockets & Socket.io

Setting up socket.io on the sever, Establishing a connection from the client, Realtime potentials, Sharing the IO Instance across files, Syncrhonizing POST additions, Updating/deleting posts on all connected clients, Sorting correctly.

16. GraphQL

Setup & Queries, Mutation Schemas, Mutation resolvers, Input validation, Handling errors, Extracting data from auth token, Pagination, Uploading images, Managin user status, Using variables.

17. Deployment

Deploying different kinds of apps, Deployment preparatins, Environment variables, Production API Keys, Secure response headers with Helmet, Compressing assets, Request logging, Setting up a SSL erver, Hosting providers, Deploying APIs.

18. Testing Node.js applications

Why and how to test, Testing auth middleware, Organizing multiple tests, What not to test, Testing controllers, Testing asyncrhonous code, Using stubs, Testing code with an active database, Cleaning up, Hooks, Testing code that requires authentication.

19. Node.js as a Build tool & NPM

Npm & Nodejs, Versioning in package.json, Build tools, Using Node.js in build processes.

20. Modern Javascript & Nodejs

ES Modules, Core Modules & Promises

21. NodeJS & Typescript

Why Typescript, Typescript setup, Assigning types, Type inference & type casting, Union Types, Object & Array types, Type Aliases & Interfaces, Generics, Typescript with Express, REST Routes with Typescript, Testing the API, Improving project structure.

22. Deno

22.1 Introduction: Deno setup, Deno runtime (namespace) API, Deno Permissions, Deno vs Node, How deno features are organized, Deno standard library, Creating a webserver, Oak framework with Deno, Module URLs, Deno & Node REST APIs. 22.2 Deno, CRUD & Databases (MongoDB): Handling CORS errors, Connecting Deno to Mongodb, Using MondoDB CLient Module, Deno MongoDB CRUD Operations.

💻 TECHNOLOGIES

BACK-END (NodeJS + TypeScript)

  • Nodemon: automatically restarting the node application when file changes in the directory are detected
  • Express: production dependency for creating robusts APIs quickly with HTTP utility methods and middleware
  • Ejs/Pug/Express-handlebars: software designed to combine templates with a data model to produce multiple pages that share the same look throughout the site. These are the views in an MVC project.
  • Mysql2: mySQL to interact with the database
  • Sequelize: Object-Relational Mapping Library that uses mysql2 to interact with the database running the queries behind the scenes
  • Mongodb: MongoDB Driver to connect to MongoDB to handle the database engine (run noSQL databases for large scale applications)
  • Mongoose: Object-Document Mapping Library that allow us to define models with which we then work and where all the queries are done behind the scenes
  • Express-session: package to handle sessions, part of the official expressjs suite but not baked into expressjs itself
  • Connect-mongodb-session: let our express session package store data in the database
  • Bcryptjs: encrypting passwords
  • Csurf: Node.js CSRF protection middleware. It generates a csrf token (string value we can embed into our forms/pages for every request that on the backend changes the users state, so anything that does something sensitive which we want to protect against).
  • Connect-flash: flash is a special area of the session used for storing messages. Messages are written to the flash and cleared after being displayed to the user. The flash is typically used in combination with redirects, ensuring that the message is available to the next page that is to be rendered
  • Nodemailer: send emails from inside nodejs
  • Express-validator: validate forms on the server
  • Multer: parses incoming requests handling files and being able to handle file requests as well or requests with mixed data, with text and file data.
  • Pdfkit: pdf generator
  • Stripe: suite of payment APIs that allows online payment processing
  • Typescript: strongly typed programming language that builds on JavaScript
Deployment And Security
  • Helmet: secure node express application: set headers to responses following best practices regarding attack patterns/security issues
  • Compression: Nodejs express middleware that serves optimized assets
  • Morgan: simplify logging request data
Testing
  • Mocha: runs tests (executing the test code)
  • Chai: asserts results (validating the test outcome)
  • Sinon: creates Stubs, which is a replacement for the original function where we can easily restore the original set up, clearing stub functions.
REST API
  • Jsonwebtoken: creates JSON web tokens for authentication on REST APIs. Creates data with optional signature and/or encryption whose payload holds JSON and is signed either using a private secret or a public/private key.
  • Socket.io: (server) web sockets with a lot of convenience features around that protocol that make it very easy to set up a web socket channel with a client in the server and to use that channel.
  • Socket.io-client: (web) socket.io for the client
Graphql
  • Graphql: required for defining the schema (definition of queries, mutations, etc) of the GraphQL service.
  • Express-graphql: server to parse incoming requests
  • Validator: validates inputs on the resolvers