Introduction to

What is Node?

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.

...Say again?

  • Ecosystem using Chrome's Javascript engine, V8, to run programs outside of the browser.
  • It is non-blocking, meaning that it can spawn multiple processes and communicate through events.
  • It is completely modular
  • It is really fast and lightweight, as opposed to systems such as .NET or JVM
  • Also, it comes with its own cross-platform package manager, npm.

Range of abilities

Node applications range in a lot of domains - it can basically do 

everything in the realm of the imagination:

  • Web Servers: Express, Koa, Hapi...
  • Database drivers: MySQL, SQLite, MongoDB...
  • Task Runners: Grunt, Gulp, Webpack...
  • Test Runners: Karma, Mocha, Selenium...
  • Command Line Tools: JSHint, Babel, Yeoman...
  • Programs: PhantomJS, PM2 (process manager)...
  • Desktop Applications: Slack, Atom...
  • Other: IoT, Web Browsers, Media Streamers, etc...

Example: Hello World Server in Node

const http = require('http');

const hostname = '127.0.0.1';
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/html');
  res.end('<body>Hello World!</body>');
});

server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
});

The Node API

  • File System operations: Paths, OS, FS
  • Network operations: TCP/IP, DNS
  • Process Management
  • HTTP Requests
  • Streams
  • Sockets
  • Buffers, I/O
  • etc...

Title Text

Subtitle

Made with Slides.com