Code and Learn

Code and Learn

If the workshop hasn't started yet:

  • Learn Github - google for "Egghead Introduction to GitHub" (first 4 lessons)
  • Ensure that Git is installed on your machine (git-scm)
  • Go through Building.md from nodejs on Github and ensure that you have Prerequisites software installed
  • install VSCode

Trivikram Kamat

Twitter: @trivikram

Github: @trivikr

Ashish Kaila

Twitter: @ashishkaila

Github: @akaila

What will you learn?

  • Quick history up to V8
    • CPU and machine code
    • JavaScript and ECMAScript
    • JavaScript Engines
    • Chrome's V8
  • How can JavaScript manage a server?
  • What problems Node.js solves
  • Let's write a Node.js server
  • Explore Node.js documentation
  • Dig into the source code
  • Create and submit a PR live on stage!
  • Create more PRs

How popular is Node.js?

Pre-requisites

Go through Getting Started with Node.js core to fork, clone and build the repository on your machine

CPU and Machine Code

Instruction Sets

  • ARM

  • IA-32

  • MIPS

  • x64

A standard on which JavaScript is based on

JavaScript Engine

Program which executes JavaScript code

JavaScript

Code

Machine

Code

Chrome's V8 engine

JavaScript

Code

Machine

Code

Your C++ Program

JavaScript

Code

Machine

Code

What JavaScript had to do to manage a server?

  • Better ways to organize our code into reusable pieces
  • Ways to deal with files and databases
  • Ability to communicate over the internet
  • Ability to accept standard request and send responses

Why are we excited about Node.js?

  • Extremely simple and minimal
  • Easy to discover and consume packages
  • Increase in developer productivity
  • True asynchronous I/O operations

Let's install Node.js!

Install Node.js using nvm curl command

Your first Node.js server

const http = require("http");

http.createServer((req, res) => {

    res.end("Hello World!\n");

}).listen(3000);

Copy the above code or clone from

https://github.com/trivikr/simple-nodejs-server

Let's go through the Node.js documentation!

Let's dig into the source code!

Let's create a Pull Request live! 😊  

Vidalia

Node.js Code and Learn

By Trivikram Kamat

Node.js Code and Learn

Node.js Code+Learn

  • 856