Skip to content

Commit ba86aa0

Browse files
Build an App with Firebase
1 parent c93fb12 commit ba86aa0

File tree

5 files changed

+54
-11
lines changed

5 files changed

+54
-11
lines changed

01-getting-started-with-angular2/final-project/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"pree2e": "webdriver-manager update",
1111
"e2e": "protractor",
1212
"populate-db": "./node_modules/.bin/ts-node ./populate-db.ts",
13-
"server": "ts-node src/server/firestack-server.ts"
13+
"server": "node src/server/firestack-server.js"
1414
},
1515
"private": true,
1616
"dependencies": {
@@ -25,6 +25,7 @@
2525
"angularfire2": "^2.0.0-beta.4",
2626
"core-js": "^2.4.0",
2727
"firebase": "^3.3.1",
28+
"firebase-queue": "^1.5.0",
2829
"lodash": "^4.15.0",
2930
"rxjs": "5.0.0-beta.12",
3031
"ts-helpers": "^1.1.1",

01-getting-started-with-angular2/final-project/src/app/shared/model/lessons.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class LessonsService {
7777

7878
deleteLesson(lessonId:string) {
7979

80-
this.dbRef.child('queues/requests/deleteLesson').push(new DeleteLessonRequest(lessonId))
80+
this.dbRef.child('queue/tasks').push(new DeleteLessonRequest(lessonId))
8181
.then(
8282
console.log, console.error
8383
);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!*.js
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
3+
var firebaseConfig = {
4+
apiKey: "AIzaSyBhuIkN2d6xNe7DwxzjCRhBIWiu1-mJ9vo",
5+
authDomain: "final-project-ac645.firebaseapp.com",
6+
databaseURL: "https://final-project-ac645.firebaseio.com",
7+
storageBucket: "final-project-ac645.appspot.com"
8+
};
9+
10+
/*
11+
12+
var authConfig = {
13+
provider: AuthProviders.Password,
14+
method: AuthMethods.Password
15+
};
16+
17+
*/
18+
19+
console.log('Initializing FIREStack server ...');
20+
21+
22+
23+
24+
var firebase = require('firebase');
25+
26+
var app = firebase.initializeApp(firebaseConfig);
27+
var root = app.database();
28+
29+
30+
var Queue = require('firebase-queue');
31+
var queueRef = root.ref('queue');
32+
33+
34+
var queue = new Queue(queueRef, function(data, progress, resolve, reject) {
35+
36+
// Read and process task data
37+
console.log(data);
38+
39+
// Update the progress state of the task
40+
setTimeout(function() {
41+
console.log('50%');
42+
progress(50);
43+
}, 500);
44+
45+
// Finish the job asynchronously
46+
setTimeout(function() {
47+
console.log('100%');
48+
resolve();
49+
}, 1000);
50+
});

01-getting-started-with-angular2/final-project/src/server/firestack-server.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)