Repository contains concepts and code related to Node JS (Vanilla Node, Express Framework, REST APIs, GraphQL, Websockets & More...) & Deno, both as a Runtime Environment.
- NodeJS Course by Maximilian SchwarzmΓΌller
- NodeJS Documentation
- Ben Awad's Fullstack Tutorial on YouTube
- What is NodeJS?
- Software Requirements
- Compiler Details
- Role & Usage of NodeJS
- Node Lifecycle & Event Loop
- Running NodeJS + TypeScript
- NodeJS β Behind the Scenes: Single Thread, Event Loop & Blocking Code (Deep Dive) πβ¨ β MUST READ!
- Event Loop, Timers & process.nexttick - Official NodeJS Docs
- Don't Block the Event Loop - Official NodeJS Docs
- The Concept of Middleware
- What's the Model-View-Controller Architecture?
- Why Databases? β Must Read
- SQL v/s NoSQL Databases β Must Read
- Introduction
- Understanding Basics
- Express Framework π πͺπ¨
- Dynamic Content & Templating Engines
- Models Views & Controllers
- Dynamic Routes & Advanced Models
- Databases β Prerequisites
- SQL Introduction
Contents of this section are in node-first-app directory.
- First NodeJS App: Commit Details
- Writing to a new file using
fs
module withfs.writeFileSync()
method (Basic Intro): Commit Details
Contents of this section are in understanding-basics directory.
- Creating a Node Server: Commit Details
- The Node Lifecycle & Event Loop: READ THIS BEFORE MOVING AHEAD | Commit Details
- Understanding the
request
object (request.url
,request.method
&request.headers
): Commit Details - Sending Responses using
response.write()
&response.end()
: Commit Details - Diving deeper into the
request
object- Routing Requests using
request.url
: Commit Details - Redirecting Requests
request.url && request.method
by usingfs.writeFileSync
along withresponse.writeHead()
(orresponse.setHeader()
/response.statusCode
) to write a to a file on a specific route: Commit Details - Parsing Request Bodies using
request.on('data')
,request.on('end')
&Buffer.concat()
: READ THIS BEFORE GOING AHEAD | Commit Details
- Routing Requests using
- Understanding Event Driven Code Execution β
- Blocking β
writeFileSync()
& Non-Blocking βwriteFile()
Code: Commit Details - NodeJS β Behind the Scenes: Single Thread, Event Loop & Blocking Code (Deep Dive) πβ¨ β MUST READ!
- Using the Node Modules System β
exports
&imports
(ES5/ES6+): Commit Details - Assignment I: Solution - I && Solution - II (revision)
- Debugging using VS Code's NodeJS Debugger: Commit Details π
Contents of this section are in working-with-express directory.
- Prerequisite: A Basic Setup: Commit Details
- Installing Express & Using
express()
: Commit Details - Adding Middleware using
app.use()
: Commit Details - How Middleware Works: Commit Details
- Express.js β Looking Behind the Scenes: Commit Details
- Handling Different Routes: Commit Details
- Assignment II: Solution && Solution-II (revision)
- Parsing Incoming Requests using
express.urlencoded({ extended: false })
(or,bodyParser
[deprecated]) passed toapp.use()
middleware: Commit Details - Limiting Middleware Execution to POST/GET Requests Using
app.get()
&app.post()
: Commit Details - Using Express Router using
express.Router()
: Commit Details - Adding a 404 Error Page using
res.status(400).send()
: Commit Details - Filtering & Grouping Routes/Paths Logically: Commit Details
- Creating HTML Pages: Commit Details
- Serving HTML Pages using
path.join()
&__dirname
: Commit Details - Returning a 404 Error Page: Commit Details
- Using a Helper Function for Navigation using
path.dirname(require.main.filename)
: Commit Details - Styling HTML Pages: Commit Details
- Serving Files Statically using
express.static()
middleware: Commit Details - Assignment III: Solution && Solution-II (Revision) π
Contents of this section are in dynamic-content-templating-engines directory.
- Basic Setup: Commit Details
- Sharing Data Across Requests & Users: Commit Details
- Templating Engines: Commit Details
- Templating Engines:
- Installing Pug, Handlebars & EJS:
- Packages:
npm i --save pug express-handlebars ejs
- TypeScript Support:
npm i -D @types/pug @types/express-handlebars @types/ejs
- Packages:
- Pug β Minimalist Syntax πΆ [Supported in Express Out of the Box]:
- Using the Pug Templating Engine: Commit Details π
- Outputting Dynamic Content Using Pug Templates β
each
,if
,else
&#{<object_name>}
: Commit Details & Commit Details - Fixed.active
class bug - Converting Remaining HTML files to Pug templates: Commit Details
- Adding a Base Layout using
block
s & Extending that Layout to other templates usingextends <layout-name>
: Commit Details - Finishing the Pug Template by adding conditional
.active
class
property to elements in templates: Commit Details
- Handlebars β Templating language syntax similar to HTML, but keep the logic separate from the view π¨πΎ [No Support from Express]:
- Working with Handlebars: Commit Details
- Converting our Project to Handlebars: Commit Details
- Adding the Layout to Handlebars: Commit Details
- EJS β Closest to JS, Simple Syntax & HTML like syntax πβ[Supported in Express Out of the Box]
- Working with EJS: Commit Details
- Working on the Layout with Partials/Includes using
<%- include(<path>) %>
: Commit Details
- Assignment IV:
- Solutions using Pug Template Engine:
- Solution-I && Commit Details
- Revision β Solution-II && Commit Details
- Solutions using Handlebars Template Engine:
- Revision β Solution-I && Commit Details
- Solutions using EJS Template Engine:
- Solution-I && Commit Details
- Revision β Solution-II && Commit Details
- Solutions using Pug Template Engine:
- Installing Pug, Handlebars & EJS:
Contents of this section are in model-view-controller directory.
- What's MVC? ββ
- Adding Controllers: Previous Setup -> What needs changing? -> Moving Core Logic to
controllers
directory - Adding all other controllers β controller for error 404 route: Commit Details
- Adding a
Product
Model usingSingleton Pattern
: Commit Details - Storing Data (Model) in Files via the
fs.readFile()
andfs.writeFile()
functions: Commit Details - Restructuring the directory structure for online shop application: Commit Details ππ
- Working on the Navigation β Adding New Links: Commit Details
- Registering Routes for New Navigation Items: Commit Details
- Letting the User Add More Fields (vis.
Image URL
,Price
&Description
) & Storing that Data: Commit Details - Displaying Product Data: Commit Details
- Preparing for Editing & Deleting Products: Commit Details
- Adding another view/route: Commit Details
Contents of this section are in dynamic-routes-advanced-models directory.
- Basic Setup: Commit Details
- Adding Product ID to the Query Path: Commit Details
- Dynamic Routes (Eg:
/products/:productId
) & Extracting Dynamic Params usingreq.params.productId
: Commit Details - Loading Product Details Data: Commit Details β¨β¨ β Many concepts covered!
- Rendering the Product Detail View: Commit Details
- Passing Data with
POST
Requests: Commit Details - Adding a Cart Model: Commit Details β¨β¨β¨ V.V.Imp Section β Understand this before moving on!
- Accessing Query Parameters in Controllers using
request.query
- Rendering the Edit Page Manually: Commit Details
- Pre-populating the Edit Product Page w. Data: Commit Details
- Linking to the Edit Page β Reaching Edit Product Page through
Edit
button on the respective product: Commit Details β - Updating Product Data Model to Enable Editing Product Data: Commit Details
- Adding the Product Delete Functionality
- Changes in Product Model: Commit Details
- Deleting Cart Items i.e., Changes in Cart Model: Commit Details
- 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 bothProduct
andCart
models
Contents of this section are in db-intro directory.
- Why Databases? β Must Read
- SQL v/s NoSQL Databases β Must Read
Contents of this section are in sql-sequelize directory.
- Initial Setup of MySQL on Ubuntu 18.04
- Connecting Our App to the MySQL DB & Basic Retrieval: Commit Details;
- Basic Retrieval & Updation from Tables using
mysql2
: Commit Details