Node Js

Home | JavaScript

Node Js

Node.jsĀ® is a JavaScript runtime built on Chrome's V8 JavaScript engine.

From the perspective of a frontend developer who extensively uses JavaScript,
Node.js apps bring with them a huge advantage: the comfort of programming everything
- the frontend and the backend - in a single language.


*** Node JS Getting Started Guide *** | *** Node js Learn *** | How to Install Node | Node Documentation | *** Install Package Manager Mac os ***

Note: Ctl c to Stop Node Server in Terminal

How Much JS You Need to Knowledge To Use Node
Bash Commands | Mac Terminal Commands |

Nodemon

NPMJS Nodemon | YT Nodemon | Github Sample File
*** Replit & Nodejs *** | Stack Blitz Node

JavaScript Concepts

recommend you to have a good grasp of the main JavaScript concepts before diving into Node.js:
Lexical Structure, Expressions, Types, Classes, Variables, Functions, this, Arrow Functions Loops, Scopes, Arrays, Template Literals, Semicolons, Strict Mode ECMAScript 6, 2016, 2017

Lexical Structure | Expressions | Types | Classes | Variables
RG Functions | This | RG Arrow Functions | RG Loops | Arrays
Template Literals | Semi Colons | Strict Mode | ECMAScript 6, 2016, 2017

With those concepts in mind, you are well on your road to become a proficient JavaScript developer, in both the browser and in Node.js.


The following concepts are also key to understand asynchronous programming, which is one of the fundamental parts of Node.js:
Asynchronous programming and callbacks, Timers, Promises, Async and Await, Closures, The Event Loop

Asynchronous Programming and Callbacks | Timers | Promises | Async await | Closures | Event Loop Differences between Node.js and the browser

Note: Building apps that run in the browser is a completely different thing than building a Node.js application.
*****
*** Run Node from the Command Line *** | *** How to Exit Node ***

Many times with Node.js we start servers, like this HTTP server:


  const express = require('express')
const app = express()

app.get('/', (req, res) => {
  res.send('Hi!')
})

app.listen(3000, () => console.log('Server ready'))

Node Repl | Replit Browser App | Node Accept Arguments from the Command Line |

  const oranges = ['orange', 'orange']
const apples = ['just one apple']
oranges.forEach(fruit => {
  console.count(fruit)
})
apples.forEach(fruit => {
  console.count(fruit)
})


YouTube Episode on Nodejs

** FireShip Nodejs Episode **
NPMJS | NPM Express

Note: Callback Hell Can Become an Issue, Use Promises to Alleviate This Particular Issue

Google App Engine
*** FireShip io Pro $$$ ***


Evernote: J0 Zero
Text Expander: njs; Zero Zero
!! Paused Here Wednesday January 12 2022 0707 AM
and here.....>>>>> Wednesday January 12 2022 1003 AM











Node Learn | ** VS Code Nodejs Tuts **| Runkit | Runkit Playground
Nodejs Org | * Demo s2 Node js *
MDN Ternary Operator
Nodejs Org | Nodejs Wikipedia | Blocking vs Non-Blocking Calls | HTTP Status Codes Wiki

Node Package Manager (NPMJS)

NPM

WebPack

Webpack | YT Webpack

In Terminal



npm install webpack webpack-cli  

*** Learn Web Code Github YT Files Finished Product Example Code: ***

Mongo DB

Mongo DB

Express

*** Expressjs *** | *** Express Installing *** | *** Express Glossary ***

Templating Engines

*** EJS *** | Handlebars js | Pug | Templating Engines | CDN Ejs

Koajs

Koa js

YouTube Episodes Node.js

*** Node.js and NPM Tutorial: readFile & writeFile, Require Modules, and Install Packages ***
*** Learn Express.js In 48 Minutes: Web Server Tutorial ***
*** Learn Web Code Github Files *** | ** YT Ejs Node.js Express EJS Layouts and Partials Tutorial **
What is Nodejs | Nodemon


What is Middleware?

Router Level Middleware

Middle Functions

Notes: Code Snippets Below include express js, routes, path functionality built into node.js,
__dirname "public" as server data is private and not available to the public



          const express = require("express")
          const app = express()
          const path = require("path")
          
          app.use(express.urlencoded({ extended: false }))
          app.use(getWeather)
          app.use(express.static(path.join(__dirname, "public")))
          
          app.set("view engine", "ejs")
          app.set("views", path.join(__dirname, "views"))
          
          function getWeather(req, res, next) {
            req.visitorWeather = false
            if (req.visitorWeather) {
              res.send("Please come back to our app when it is not raining.")
            } else {
              next()
            }
          }
          
          app.get("/", (req, res) => {
            res.render("home", {
              isRaining: req.visitorWeather,
              pets: [
                { name: "Meowsalot", species: "cat" },
                { name: "Barksalot", species: "dog" }
              ]
            })
          })
          
          app.get("/about", (req, res) => {
            res.send("Thanks for learning more about us.")
          })
          
          app.post("/result", (req, res) => {
            if (req.body.color.trim().toUpperCase() === "BLUE") {
              res.send("Congrats, that is correct.")
            } else {
              res.send("Incorrect, please try again.")
            }
          })
          
          app.get("/result", (req, res) => {
            res.send("Why are you visiting this URL?")
          })
          
          app.get("/api/pets", (req, res) => {
            res.json([
              { name: "Meowsalot", species: "cat" },
              { name: "Barksalot", species: "dog" }
            ])
          })
          
          app.listen(3000)
          

Ejs Templating Engine = /views/home.ejs


          
            
              
              
              Document
              
            
            
              Welcome to the homepage!!!
          
              

What color is the sky on a clear day?

<% if (isRaining) { %>

It is raining.

<% } else { %>

It is not raining.

<% } %> <% pets.forEach(pet => { %>
  • <%= pet.name %> (<%= pet.species %>)
  • <% }) %>
    
    
    
    
    
    
    
    


    Tutorials

    Udemy Brad Schiff | YT Brad Schiff Channel All Episodes | Full Playlist

    React

    *** Learn React.js in 70 Minutes: JSX & useState Tutorial ***

    Other Related Stuff

    Templates Main | Fonts Importing

    Last Updated:

    Thursday January 13 2022