Working with NodeJS

Preview:

Citation preview

Working With NodeJSBy Vu Tran

September 4, 2016

A Brief Introduction of Myself

• Self-taught since H.S.

• Past and Current Involvement:

• Worked with many high profile clients

• Consulting and startups

• Open-source

vutran @tranvu

What Is Node?

• Non-blocking event-driven JavaScript runtime

• Built on V8 (same engine used by Chrome)

What Isn’t Node?

• Language (JavaScript, Ruby, Python, etc.)

• Framework (Rails, Phoenix, Laravel)

• Server (Apache, Nginx, etc.)

Simple Web Server

Blocking I/O

• Synchronous executions

• Easier to read

• If you like standing in line at Starbucks

Non-Blocking I/O

• Asynchronous executions

• Higher concurrency

Pseudo Starbucks App

File System (fs)

• Access to the file system

• Async/Sync Methods

• Streams

Streams

• Great for handling big data

• pipe() chunks of data

Reading Large Files (fs + stream + readline)

Parsing Raw Data

Parsing Raw Data

Don’t Repeat Yourself!

• Too much code to remember

• Duplicate code through the entire project

• There’s a module for that!

• Write a new module if there isn’t one

• Publish your modules on npm/github

• Private modules