• Tech Talk

    HACKATHON STARTER

    An Introduction to Node.js with Practical Solutions

    Fork me on github

Node Overview

Node.js is a server side platform built on Chrome's V8 javascript engine for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

  • Node was Created by Ryan Dahl in 2009
  • Node is server side javascript and a command line tool
  • V8 is an open source js engine developed by google
  • Everything in node runs in a single-thread
  • Node itself isn’t just JavaScript - 40% js 60% C++
  • Though programs for node.js are written in js there is no DOM
  • The non-blocking I/O is implemented with Event-loops via JS's callback functionality.

 

"But I can do everything I need in: ruby, python, php, java, ... !".

I hear you. And you are right! Node is no freaking unicorn that will come and do your work for you, sorry. It's just a tool, and it probably won't replace your regular tools completely, at least not for now. :: Understanding node.js

"Node.js is only suitable for writing small APIs, not for serious web sites or web applications".

This is bull*hit. I have to say it. :: Part I, Part II, Part III, Part IV, Part V

 

Node as a UI layer

The Downside of this approach is the use of two separate servers, adds more complexity. Using node.js with django is all about choosing an IPC method to communicate between two separate process, results in unnecisary compexity? I think the best way is simply for each layer to talk to the data base seperatly.

 

Node's Nitchs — Today

  • Small Website Projects
  • Large progects as a UI layer
  • http, tcp, dns, static file servers
  • Real time apps like chating or games
  • A service or tool for a realtime feature
  • Comand line tool

 

Pros

Node Frameworks

These Frameworks are to Node as Rails is to Ruby

 

 

Enviorment

  • Node.js
  • NPM - Node Package Manager. (NPM comes bundled with node.js)
  • MongoDB - an open-source document database, and the leading NoSQL database.
  • Mongoose - elegant mongodb object modeling for node.js
  • Express JS - web application framework for node
  • Connect - a middleware framework for node, bundled with express
  • Socket.io - makes realtime apps possible in every browser and mobile device, blurring the differences between the different transport mechanisms. It's care-free realtime 100% in JavaScript.
  • Jade - Node template Engine
  • EJS - EJS cleans the HTML out of your JavaScript with client side templates.
  • nodemon - a utility that will monitor for any changes in your source and automatically restart your server. Perfect for development.
  • Backbone.js, Naturally

 

Enter Hackathon starter

  • Hackathon Starter »
  • If you're going the bespoke route, its very helpfull to have a base project to start from.
  • A starter app that puts the enviorment and common patterns together.

 

Making a real time API