From 0cc2a2ec8d40b5b9c07b23b28f4218b768844777 Mon Sep 17 00:00:00 2001 From: Chris Sevilleja Date: Wed, 13 Nov 2013 08:49:11 -0800 Subject: [PATCH 1/9] removing intialize --- public/core.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/public/core.js b/public/core.js index 326464d07..0910b0c7e 100644 --- a/public/core.js +++ b/public/core.js @@ -4,15 +4,13 @@ function mainController($scope, $http) { $scope.formData = {}; // when landing on the page, get all todos and show them - $scope.initialize = function() { - $http.get('/api/todos') - .success(function(data) { - $scope.todos = data; - }) - .error(function(data) { - console.log('Error: ' + data); - }); - }; + $http.get('/api/todos') + .success(function(data) { + $scope.todos = data; + }) + .error(function(data) { + console.log('Error: ' + data); + }); // when submitting the add form, send the text to the node API $scope.createTodo = function() { @@ -37,4 +35,4 @@ function mainController($scope, $http) { }); }; -} \ No newline at end of file +} From 75155c63506506be86aa1525533c83376491e958 Mon Sep 17 00:00:00 2001 From: Chris Sevilleja Date: Wed, 13 Nov 2013 08:49:25 -0800 Subject: [PATCH 2/9] removing ng-init --- public/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/index.html b/public/index.html index 87735cdeb..a944bb403 100644 --- a/public/index.html +++ b/public/index.html @@ -25,7 +25,7 @@ - +
@@ -71,4 +71,4 @@

I'm a Todo-aholic {{ todos.length }} - \ No newline at end of file + From ac2454ac49ba4d4322d35e07287998dfcd30e04a Mon Sep 17 00:00:00 2001 From: Chris Sevilleja Date: Tue, 25 Feb 2014 08:47:15 -0800 Subject: [PATCH 3/9] Update core.js --- public/core.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/core.js b/public/core.js index 0910b0c7e..fdfff183c 100644 --- a/public/core.js +++ b/public/core.js @@ -16,8 +16,9 @@ function mainController($scope, $http) { $scope.createTodo = function() { $http.post('/api/todos', $scope.formData) .success(function(data) { - $('input').val(''); + $scope.formData = {}; // clear the form so our user is ready to enter another $scope.todos = data; + console.log(data); }) .error(function(data) { console.log('Error: ' + data); From e2050646a85f3ac0aed31c7588f779fd587e5ab8 Mon Sep 17 00:00:00 2001 From: Chris Sevilleja Date: Thu, 17 Apr 2014 10:31:42 -0700 Subject: [PATCH 4/9] Update index.html --- public/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/public/index.html b/public/index.html index a944bb403..a6f57db3a 100644 --- a/public/index.html +++ b/public/index.html @@ -19,7 +19,6 @@ - From 381de195e2d1dbe34dba8b05544e0f984c44136f Mon Sep 17 00:00:00 2001 From: Chris Sevilleja Date: Wed, 30 Jul 2014 15:50:40 -0700 Subject: [PATCH 5/9] updating to express 4 --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0f84bec6d..47d8c7454 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,9 @@ "main" : "server.js", "author" : "Scotch", "dependencies" : { - "express" : "~3.4.4", - "mongoose" : "~3.6.2" + "express" : "~4.7.2", + "mongoose" : "~3.6.2", + "morgan" : "~1.2.2", + "body-parser": "~1.5.2" } } From a513b80e1fc167ebc247f6d7b949cf298a375edd Mon Sep 17 00:00:00 2001 From: Chris Sevilleja Date: Wed, 30 Jul 2014 15:52:55 -0700 Subject: [PATCH 6/9] updating for express 4 --- server.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/server.js b/server.js index 9f8736fac..c869cb7a3 100644 --- a/server.js +++ b/server.js @@ -5,15 +5,19 @@ var mongoose = require('mongoose'); // mongoose for mongodb var port = process.env.PORT || 8080; // set the port var database = require('./config/database'); // load the database config +var morgan = require('morgan'); // log requests to the console (express4) +var bodyParser = require('body-parser'); // pull information from HTML POST (express4) +var methodOverride = require('method-override'); // simulate DELETE and PUT (express4) + // configuration =============================================================== mongoose.connect(database.url); // connect to mongoDB database on modulus.io -app.configure(function() { - app.use(express.static(__dirname + '/public')); // set the static files location /public/img will be /img for users - app.use(express.logger('dev')); // log every request to the console - app.use(express.bodyParser()); // pull information from html in POST - app.use(express.methodOverride()); // simulate DELETE and PUT -}); +app.use(express.static(__dirname + '/public')); // set the static files location /public/img will be /img for users +app.use(morgan('dev')); // log every request to the console +app.use(bodyParser.urlencoded({'extended':'true'})); // parse application/x-www-form-urlencoded +app.use(bodyParser.json()); // parse application/json +app.use(bodyParser.json({ type: 'application/vnd.api+json' })); // parse application/vnd.api+json as json +app.use(methodOverride()); // routes ====================================================================== require('./app/routes.js')(app); From 3e2028a382484130674e9fbddc226425c6436e45 Mon Sep 17 00:00:00 2001 From: John Zanchetta Date: Tue, 16 Sep 2014 13:48:31 +0100 Subject: [PATCH 7/9] added missing "method-override": "~2.1.2" --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 47d8c7454..26d4d0b17 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "dependencies" : { "express" : "~4.7.2", "mongoose" : "~3.6.2", - "morgan" : "~1.2.2", - "body-parser": "~1.5.2" + "morgan" : "~1.2.2", + "body-parser": "~1.5.2", + "method-override": "~2.1.2" } } From 427bbf1d0110cfa6ee7b63c4c6c6710615c9327c Mon Sep 17 00:00:00 2001 From: Chris Sevilleja Date: Sat, 13 Dec 2014 12:37:46 -0800 Subject: [PATCH 8/9] Update README.md --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index 301c768ba..63506a974 100644 --- a/README.md +++ b/README.md @@ -17,15 +17,7 @@ Node provides the RESTful API. Angular provides the frontend and accesses the AP ## Tutorial Series -This repo corresponds to the Node Todo Tutorial Series on [scotch.io](http://scotch.io) - -Each branch represents a certain tutorial. -- tut1-starter: [Creating a Single Page Todo App with Node and Angular](http://scotch.io/tutorials/javascript/creating-a-single-page-todo-app-with-node-and-angular) -- tut2-services: Coming Soon -- tut3-auth: Coming Soon -- tut4-sockets: Coming Soon -- tut5-redis: Coming Soon -- tut6-organization: Coming Soon +This repo corresponds to the [Node Todo Tutorial Series](http://scotch.io/series/node-and-angular-to-do-app) on [scotch.io](http://scotch.io) Happy Todo-ing! From 79f37bda07563b694561d6d93016b957d56698d6 Mon Sep 17 00:00:00 2001 From: Chris Sevilleja Date: Thu, 26 Mar 2015 07:48:54 -0700 Subject: [PATCH 9/9] Update database.js --- config/database.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/database.js b/config/database.js index ed8735ffa..cd3586632 100644 --- a/config/database.js +++ b/config/database.js @@ -1,5 +1,5 @@ module.exports = { // the database url to connect - url : 'mongodb://node:node@mongo.onmodulus.net:27017/uwO3mypu' -} \ No newline at end of file + url : 'mongodb://node:nodeuser@mongo.onmodulus.net:27017/uwO3mypu' +}