cnandreu / oreilly-webinar

Introducing a Mobile-First Approach to Building Your Next App. This event took place live on October 30 2013.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prerequisites

Node.js Hello World

The application inside will show a simple 'Hello World' Node.js application.

  • cd 1NodeHelloWorld/ - Go into the main folder.
  • node hello.js - Run the Node.js application.
  • Open your favorite web browser (e.g. Chrome, Firefox, Safari, IE) and visit: http://127.0.0.1:1337/.

Node.js HTTP

The application inside will show a simple Web Server using Node.js.

Node.js + Express + Mongo + jQuery

The application inside will show a working REST API that returns contact objects (e.g. {name: 'carlos', age: 25}). It will also show a jQuery single page application that will show the contact objects, filter them and allow the end-user to add new contact objects.

  • cd 3NodeExpressMongojQuery - Go into the main folder.
  • npm install - Install the right dependencies for the server (express and mongoose).
  • cd 3NodeExpressMongojQuery/public/ - Go into the public folder.
  • bower install - Install the right dependencies for the client (jquery).
  • cd .. - Go back to the main folder (3NodeExpressMongojQuery).
  • mongod - Start the MongoDB daemon.
  • You may want to change the port from 80 to something else in server.js. Otherwise, you must run the next command with sudo. I will assume it will run on port 80.
  • [sudo] node server.js - Run the server.
  • If you have contacts in your database you should see them by visiting: http://localhost/api/contacts
  • Visit the jQuery single page application here: http://localhost/.

Node.js + Express + Mongo + AngularJS

This application is similar to the jQuery Single Page application above. However, this one uses a higher level framework that allows the code to be more structured using the Model View Controller pattern.

  • cd 4NodeExpressMongoAngular - Go into the main folder.
  • npm install - Install the right dependencies for the server (express and mongoose).
  • cd 4NodeExpressMongoAngular/public/ - Go into the public folder.
  • bower install - Install the right dependencies for the client (angular and bootstrap).
  • cd .. - Go back to the main folder (4NodeExpressMongoAngular).
  • mongod - Start the MongoDB daemon.
  • You may want to change the port from 80 to something else in server.js. Otherwise, you must run the next command with sudo. I will assume it will run on port 80.
  • [sudo] node server.js - Run the server.
  • Visit the Angular single page application here: http://localhost/.

Node.js + Express + Mongo + AngularJS + Apache Cordova

This application uses the Node.js + Express REST API we have been using get get the contact objects to the client. These contact objects are still being saved using MongoDB. Angular is still used to provide structure to our application. The difference is this application is packaged as a mobile application. You could submit it to one of the Mobile Application Stores (Apple's App Store, Google Play, etc).

  • cd 4NodeExpressMongoAngular - Go into the main folder.
  • Make sure www/scripts/app.js (line 38) is pointing to your local IP address (not 'localhost').
  • cd wwww and bower install - Install the right dependencies for the client (angular and bootstrap).
  • cordova emulate ios will open the application in the iOS simulator. You must be running on a Mac and have Xcode installed.
  • cordova emulate android will open the application in the Android emulator. You must have the ANDROID_SDK in your path, get it here. If you have issues getting geolocation information on android, it could be an issue with cordova.

About

Introducing a Mobile-First Approach to Building Your Next App. This event took place live on October 30 2013.

License:Apache License 2.0


Languages

Language:JavaScript 56.0%Language:Objective-C 33.8%Language:Java 5.6%Language:Shell 2.8%Language:CSS 1.5%Language:AppleScript 0.2%Language:C# 0.2%Language:C 0.2%