Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

angularJS Sample application.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 config
Octocat-spinner-32 db
Octocat-spinner-32 node_modules
Octocat-spinner-32 public
Octocat-spinner-32 test
Octocat-spinner-32 Procfile
Octocat-spinner-32 README.md
Octocat-spinner-32 npmfile.js
Octocat-spinner-32 package.json
Octocat-spinner-32 server.js
README.md

== Welcome to the Getting Started with AngularJS

Challenge Requirements

Create a simple self-service registration/login and user preferences application using using Angular, node and Mongo. Once logged in, create a preferences page that stores some dummy preference in MongoDB but make sure to include state, zip code and favorite type of sushi. Show the temperature/weather based on the user's zip code.

This sample application demonstrates how to:

  • Build a simple MVC AngularJS, Node.js and MongoDB application.
  • AngularJS Module resources, simple form validation.
  • Use Twitter Bootsrap for styling and transitions.
  • The backend code runs on Node.js.

The starting point of this sample application was made with a combination of:

MVC Architecture:

This sample application was built with the AngularJS MVC (front-end) and Node.js RailwayJS MVC (back-end) framework and MongoDB as the datasource repository.

Node.js RailwayJS MVC Routes:

  POST   /users.:format?              users#create
     Used to create the user account.

  PUT    /users/:id.:format?          users#update
     Used to update the user account information/preferences.

  GET    /users/:id.:format?          users#show
     Used to load the user account information.

  POST   /signin                      user_sessions#create
     Used to sigin the user into the application.

  GET    /weather/:weather_id/weather weather#byzipcode
     Used to get the Weather information. This uses the WeatherBug REST API.
     The var WEATHER_BUG_KEY='...' in the app/controllers/weather_controller.js needs to be set
     with your WeatherBug Key.
     Register at: http://developer.weatherbug.com/member/register


See config/routes.js file for details on the routes configured.
See the RailwayJS routes documentation for more information on how to configure routes:
       http://railwayjs.com/#routing

Node.js RailwayJS MVC Controllers:

There are three controllers in this application.

users_controller: CRUD for user account.

user_sessions: Creates session for users.

weather_controller: Proxy Service for WeatherBug REST API.

Node.js RailwayJS MVC Model:

  • The model app/models/user.js takes care of mapping the user properties to MongoDB using the Mongoose library.

    See the db/schema.js file. The Enviroment variable MONGOLAB_URI should be set to the MONGODB Server URL: "mongodb://host:port/dbname"

AngularJS MVC Controllers:

The file public/javascripts/application.js defines the AngularJS 'AppCtrl' Controller. This controller manages the flow of data between the views and the backend Node.js application.

AngularJS MVC Views:

The only view in this application index.html.

  • The (public/index.html) displays the home page (login/signup) and user home page.

Contributor:

Roberto J Rojas: robertojrojas@gmail.com

Something went wrong with that request. Please try again.