Skip to content

Commit e9f4648

Browse files
author
VGGeorgiev
committed
Updated demos
1 parent 8f8a633 commit e9f4648

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

3. Consuming-Remote-Data/Demo-Project/scripts/data-persister.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,29 @@ var application = application || {};
33
application.data = (function () {
44
function Data(rootUrl) {
55
this.rootUrl = rootUrl;
6-
this.students = new Students(rootUrl);
7-
// this.schools = new Schools();
6+
this.students = new Base(rootUrl + 'students/');
7+
this.schools = new Base(rootUrl + 'schools/');
88
}
99

10-
function Students(rootUrl) {
11-
this.serviceUrl = rootUrl + 'students/';
12-
}
10+
var Base = (function () {
11+
function Base(serviceUrl) {
12+
this.serviceUrl = serviceUrl;
13+
}
1314

14-
Students.prototype.getAll = function (success, error) {
15-
return ajaxRequester.get(this.serviceUrl, success, error);
16-
}
15+
Base.prototype.getAll = function (success, error) {
16+
return ajaxRequester.get(this.serviceUrl, success, error);
17+
}
1718

18-
Students.prototype.add = function (student, success, error) {
19-
return ajaxRequester.post(this.serviceUrl, student, success, error);
20-
}
19+
Base.prototype.add = function (data, success, error) {
20+
return ajaxRequester.post(this.serviceUrl, data, success, error);
21+
}
2122

22-
Students.prototype.remove = function (id, success, error) {
23-
return ajaxRequester.delete(this.serviceUrl + id, success, error);
24-
}
23+
Base.prototype.remove = function (id, success, error) {
24+
return ajaxRequester.delete(this.serviceUrl + id, success, error);
25+
}
26+
27+
return Base;
28+
}());
2529

2630
return {
2731
get: function (rootUrl) {

3. Consuming-Remote-Data/Demo-Project/scripts/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(function () {
2-
var serviceRootUrl = 'http://localhost:3000/';
2+
var serviceRootUrl = 'http://localhost:5555/';
33
var persister = application.data.get(serviceRootUrl);
44
var controller = application.controller.get(persister);
55
controller.load('#students');

3. Consuming-Remote-Data/server/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var express = require('express'),
77
var app = express();
88

99
app.configure(function () {
10-
app.set('port', process.env.PORT || 3000);
10+
app.set('port', process.env.PORT || 5555);
1111
app.set('views', __dirname + '/views');
1212
app.set('view engine', 'jade');
1313
app.use(express.favicon());

3. Consuming-Remote-Data/server/routes/students.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Generated by CoffeeScript 1.7.1
21
(function() {
32
var Student, addNewStudent, getAllStudents, lastStudentId, removeStudent, students;
43

@@ -96,6 +95,4 @@
9695
remove: removeStudent
9796
};
9897

99-
}).call(this);
100-
101-
//# sourceMappingURL=students.map
98+
}).call(this);

0 commit comments

Comments
 (0)