Ch-sriram / node-js-deno

NodeJS/Express, REST APIs, GraphQL, Web Sockets & Deno

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proof of Concept: NodeJS & Deno

Repository contains concepts and code related to Node JS (Vanilla Node, Express Framework, REST APIs, GraphQL, Websockets & More...) & Deno, both as a Runtime Environment.

References

Details on NodeJS & Express

Table of Contents Β©

Introduction

Contents of this section are in node-first-app directory.

  1. First NodeJS App: Commit Details
  2. Writing to a new file using fs module with fs.writeFileSync() method (Basic Intro): Commit Details

πŸ”

Understanding Basics

Contents of this section are in understanding-basics directory.

  1. Creating a Node Server: Commit Details
  2. The Node Lifecycle & Event Loop: READ THIS BEFORE MOVING AHEAD | Commit Details
  3. Understanding the request object (request.url, request.method & request.headers): Commit Details
  4. Sending Responses using response.write() & response.end(): Commit Details
  5. Diving deeper into the request object
    1. Routing Requests using request.url: Commit Details
    2. Redirecting Requests request.url && request.method by using fs.writeFileSync along with response.writeHead() (or response.setHeader() / response.statusCode) to write a to a file on a specific route: Commit Details
    3. Parsing Request Bodies using request.on('data'), request.on('end') & Buffer.concat(): READ THIS BEFORE GOING AHEAD | Commit Details
  6. Understanding Event Driven Code Execution ⭐
    1. Writing Events That Would Eventually Error Out: Commit Details
    2. Writing Events To Mitigate Errors: Commit Details
  7. Blocking β€” writeFileSync() & Non-Blocking β€” writeFile() Code: Commit Details
  8. NodeJS β€” Behind the Scenes: Single Thread, Event Loop & Blocking Code (Deep Dive) 🌟✨ β€” MUST READ!
  9. Using the Node Modules System β€” exports & imports (ES5/ES6+): Commit Details
  10. Assignment I: Solution - I && Solution - II (revision)
  11. Debugging using VS Code's NodeJS Debugger: Commit Details 🌟

πŸ”

Express Framework πŸš…πŸŒͺπŸ’¨

Contents of this section are in working-with-express directory.

  1. Prerequisite: A Basic Setup: Commit Details
  2. Installing Express & Using express(): Commit Details
  3. Adding Middleware using app.use(): Commit Details
  4. How Middleware Works: Commit Details
  5. Express.js β€” Looking Behind the Scenes: Commit Details
  6. Handling Different Routes: Commit Details
  7. Assignment II: Solution && Solution-II (revision)
  8. Parsing Incoming Requests using express.urlencoded({ extended: false }) (or, bodyParser [deprecated]) passed to app.use() middleware: Commit Details
  9. Limiting Middleware Execution to POST/GET Requests Using app.get() & app.post(): Commit Details
  10. Using Express Router using express.Router(): Commit Details
  11. Adding a 404 Error Page using res.status(400).send(): Commit Details
  12. Filtering & Grouping Routes/Paths Logically: Commit Details
  13. Creating HTML Pages: Commit Details
  14. Serving HTML Pages using path.join() & __dirname: Commit Details
  15. Returning a 404 Error Page: Commit Details
  16. Using a Helper Function for Navigation using path.dirname(require.main.filename): Commit Details
  17. Styling HTML Pages: Commit Details
  18. Serving Files Statically using express.static() middleware: Commit Details
  19. Assignment III: Solution && Solution-II (Revision) πŸ“œ

πŸ”

Dynamic Content & Templating Engines

Contents of this section are in dynamic-content-templating-engines directory.

  1. Basic Setup: Commit Details
  2. Sharing Data Across Requests & Users: Commit Details
  3. Templating Engines: Commit Details
  4. Templating Engines:
    1. Installing Pug, Handlebars & EJS:
      1. Packages: npm i --save pug express-handlebars ejs
      2. TypeScript Support: npm i -D @types/pug @types/express-handlebars @types/ejs
    2. Pug β€” Minimalist Syntax 🐢 [Supported in Express Out of the Box]:
      1. Using the Pug Templating Engine: Commit Details 🌟
      2. Outputting Dynamic Content Using Pug Templates β€” each, if, else & #{<object_name>}: Commit Details & Commit Details - Fixed .active class bug
      3. Converting Remaining HTML files to Pug templates: Commit Details
      4. Adding a Base Layout using blocks & Extending that Layout to other templates using extends <layout-name>: Commit Details
      5. Finishing the Pug Template by adding conditional .active class property to elements in templates: Commit Details
    3. Handlebars β€” Templating language syntax similar to HTML, but keep the logic separate from the view πŸ‘¨πŸΎ [No Support from Express]:
      1. Working with Handlebars: Commit Details
      2. Converting our Project to Handlebars: Commit Details
      3. Adding the Layout to Handlebars: Commit Details
    4. EJS β€” Closest to JS, Simple Syntax & HTML like syntax πŸ“œβ­[Supported in Express Out of the Box]
      1. Working with EJS: Commit Details
      2. Working on the Layout with Partials/Includes using <%- include(<path>) %>: Commit Details
    5. Assignment IV:
      1. Solutions using Pug Template Engine:
        1. Solution-I && Commit Details
        2. Revision β€” Solution-II && Commit Details
      2. Solutions using Handlebars Template Engine:
        1. Revision β€” Solution-I && Commit Details
      3. Solutions using EJS Template Engine:
        1. Solution-I && Commit Details
        2. Revision β€” Solution-II && Commit Details

πŸ”

Models Views & Controllers (MVC)

Contents of this section are in model-view-controller directory.

  1. What's MVC? ⭐⭐
  2. Adding Controllers: Previous Setup -> What needs changing? -> Moving Core Logic to controllers directory
  3. Adding all other controllers β€” controller for error 404 route: Commit Details
  4. Adding a Product Model using Singleton Pattern: Commit Details
  5. Storing Data (Model) in Files via the fs.readFile() and fs.writeFile() functions: Commit Details
  6. Restructuring the directory structure for online shop application: Commit Details 🌟🌟
  7. Working on the Navigation β€” Adding New Links: Commit Details
  8. Registering Routes for New Navigation Items: Commit Details
  9. Letting the User Add More Fields (vis. Image URL, Price & Description) & Storing that Data: Commit Details
  10. Displaying Product Data: Commit Details
  11. Preparing for Editing & Deleting Products: Commit Details
  12. Adding another view/route: Commit Details

πŸ”

Dynamic Routes & Advanced Models

Contents of this section are in dynamic-routes-advanced-models directory.

  1. Basic Setup: Commit Details
  2. Adding Product ID to the Query Path: Commit Details
  3. Dynamic Routes (Eg: /products/:productId) & Extracting Dynamic Params using req.params.productId: Commit Details
  4. Loading Product Details Data: Commit Details ✨✨ β€” Many concepts covered!
  5. Rendering the Product Detail View: Commit Details
  6. Passing Data with POST Requests: Commit Details
  7. Adding a Cart Model: Commit Details ✨✨✨ V.V.Imp Section β€” Understand this before moving on!
  8. Accessing Query Parameters in Controllers using request.query
    1. Rendering the Edit Page Manually: Commit Details
    2. Pre-populating the Edit Product Page w. Data: Commit Details
    3. Linking to the Edit Page β€” Reaching Edit Product Page through Edit button on the respective product: Commit Details ⭐
    4. Updating Product Data Model to Enable Editing Product Data: Commit Details
  9. Adding the Product Delete Functionality
    1. Changes in Product Model: Commit Details
    2. Deleting Cart Items i.e., Changes in Cart Model: Commit Details
  10. Fixing Edit Product Bug In Relation to Cart Pricing: Commit I - main & Commit II - for-of loop to reduce function change β€” ⭐⭐ focus on save() changes && new methods in both Product and Cart models

πŸ”

Databases β€” Prerequisites

Contents of this section are in db-intro directory.

  1. Why Databases? ⭐ Must Read
  2. SQL v/s NoSQL Databases ⭐ Must Read

πŸ”

SQL Introduction

Contents of this section are in sql-sequelize directory.

  1. Initial Setup of MySQL on Ubuntu 18.04
  2. Connecting Our App to the MySQL DB & Basic Retrieval: Commit Details;
  3. Basic Retrieval & Updation from Tables using mysql2: Commit Details

πŸ”

About

NodeJS/Express, REST APIs, GraphQL, Web Sockets & Deno

License:MIT License


Languages

Language:TypeScript 49.8%Language:EJS 22.1%Language:CSS 13.5%Language:HTML 5.6%Language:Pug 4.8%Language:Handlebars 3.3%Language:JavaScript 0.9%