intro to node

What is Node.js?

Open-source, cross-platform runtime environment for developing server-side web applications using JavaScript on server side

What you can build with it?

  • Web-chat
  • Fast file upload client
  • Ad server
  • Any real-time data apps
  • Anything

So, why node is so cool?

Event-driven

non-blocking

Asynchronous

Single thread

Callbacks

Installing node (Mac)

  • brew install nvm
  • nvm install node
  • node -v, npm -v
  • node example.js

modules

  • module.exports, exports
  • require()

Exercise

Starting node app

Rails Node.js
gem install ... npm install ...
bundle
(works when Gemfile is found)
npm 
(works when package.json is found)
bundle update npm update
rails s npm start
(reads it from package.json)

Read more about node:

Made with Slides.com