anihalaney / rwa-trivia Goto Github PK
View Code? Open in Web Editor NEWTrivia App - Real World Angular series
Trivia App - Real World Angular series
Hi Anihalaney and TY for your great job,
I have en error when I try to deploy cloud functions:
Error parsing triggers: Cannot find module './server/functions/app'
Do you have any idea ?
Regards
let x = 1; x = x * x; console.log(x);
Hi Ashkay,
Thank you for your help so far, your project is exactly what I'am trying to do.
I finally succeed to set up the Elasticsearch & Nginx part... and I am now trying to run the master version, I followed the getting started, but I have several problems, maybe could you help me to solve some of them?
In my gcloud console I can see several errors and among them these ones:
*Trace: [index_not_found_exception] no such index, with { resource.type="index_or_alias" & resource.id="questions" & index_uuid="na" & index="questions" } at /user_code/server/functions/ESUtils.js:238:21 at process._tickDomainCallback (internal/process/next_tick.js:135:7)
And in my web client (chrome)
GET https://us-central1-xxxxxxx.cloudfunctions.net/app/getQuestionOfTheDay 500 ()
Failed to load https://us-central1-xxxxxxx.cloudfunctions.net/app/getQuestionOfTheDay: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. The response had HTTP status code 500.
Effect "QuestionEffects.loadSampleQuestions$" threw an error
effects.es5.js:247 Source: QuestionEffects {actions$: Actions, questionActions: QuestionActions, svc: QuestionService, loadQuestions$: Actions, loadUnpublishedQuestions$: Actions, …}
in app.component.html
Change from
<md-toolbar [color]="primary"> to color="primary"
should fix the probelem.
Hi,
I try to serve locally the functions bit I get this error, could anyone give me a hand ?
Thx!
sudo firebase serve --only hosting,functions
=== Serving from '/Users/xxx/PROJECT/rwa-trivia-master'...
i functions: Preparing to emulate functions.
⚠ functions: Failed to emulate app
Hi,
It seems that users are not stored in rtdb nor firestore, but we have a
getUserRoles method that fetch in users collection in authentication.service.
Maybe is it planned in the futur to add users in this collection when they sign up ?
Regards,
what is your mongoose structure to manage the surveys ?
As an addition to the real world application series, it could be useful to include CI as part of a future article as it's a fairly common practice in many organizations today. CircleCI is a great option that integrates flawlessly with GitHub and has a free tier as well.
Attempted to run tests using npm test
or directly running ng test
but both on master result in type errors related to NGRX Store Payload and some additional errors related to exports.
ERROR in rwa-trivia/src/app/core/components/login/login.component.spec.ts (7,23): Module '"rwa-trivia/node_modules/angularfire2/index"' has no exported member 'AuthProviders'.
ERROR in rwa-trivia/src/app/core/components/login/login.component.spec.ts (7,38): Module '"rwa-trivia/node_modules/angularfire2/index"' has no exported member 'AuthMethods'.
ERROR in rwa-trivia/src/app/core/components/login/login.component.spec.ts (7,51): Module '"rwa-trivia/node_modules/angularfire2/index"' has no exported member 'FirebaseAuthConfig'.
.
.
.
ERROR in rwa-trivia/src/app/core/store/reducers/questions.reducer.spec.ts (135,27): Argument of type '{ "id": number; "questionText": string; "answers": { "id": number; "answerText": string; "correct...' is not assignable to parameter of type 'Expected<ArrayLike<Question>>'.
Type '{ "id": number; "questionText": string; "answers": { "id": number; "answerText": string; "correct...' is not assignable to type 'ObjectContaining<ArrayLike<Question>>'.
ERROR in rwa-trivia/src/app/core/store/reducers/questions.reducer.spec.ts (151,44): Argument of type '{ type: string; }' is not assignable to parameter of type 'ActionWithPayload<string>'.
Property 'payload' is missing in type '{ type: string; }'.
ERROR in rwa-trivia/src/app/core/store/reducers/questions.reducer.spec.ts (154,56): Argument of type '{ type: string; }' is not assignable to parameter of type 'ActionWithPayload<string>'.
Property 'payload' is missing in type '{ type: string; }'.
ERROR in rwa-trivia/src/app/core/store/reducers/user.reducer.spec.ts (35,35): Argument of type '{ type: string; }' is not assignable to parameter of type 'ActionWithPayload<User>'.
Property 'payload' is missing in type '{ type: string; }'.
ERROR in rwa-trivia/src/app/shared/components/questions/questions.component.spec.ts (38,5): Type '{ "id": number; "questionText": string; "answers": { "id": number; "answerText": string; "correct...' is not assignable to type 'Question[]'.
ERROR in rwa-trivia/src/app/shared/components/questions/questions.component.spec.ts (50,9): Type '{ "id": number; "questionText": string; "answers": { "id": number; "answerText": string; "correct...' is not assignable to type 'Question'.
ERROR in rwa-trivia/src/app/shared/components/questions/questions.component.spec.ts (52,5): Type '{ "id": number; "questionText": string; "answers": { "id": number; "answerText": string; "correct...' is not assignable to type 'Question[]'.
ERROR in rwa-trivia/src/app/shared/components/questions/questions.component.spec.ts (143,3): Type '{ "id": number; "questionText": string; "answers": { "id": number; "answerText": string; "correct...' is not assignable to type 'Question[]'.
.
.
.
Hi,
Very nice app and very well explained.
I have the feeling that the app is moving slow, for example when I switch tabs or when I press a button.
Is this because the NativeScript framework or is because of the app implementation?
Fox example a tab panel in ionic or even in Sencha Touch implemented in a hybrid app works much faster.
I tested this app with iPhone XS MAX 512 GB.
There is:
constructor(private questionService: QuestionService,
private categoryService: QuestionService) {
}
Should be:
constructor(private questionService: QuestionService) {
}
There is:
ngOnInit() {
this.sub = this.questionService.getQuestions()
.subscribe(questions => this.questions = questions);
this.sub = this.questionService.getQuestions()
.subscribe(questions => this.questions = questions);
}
Should be:
ngOnInit() {
this.sub = this.questionService.getQuestions()
.subscribe(questions => this.questions = questions);
}
I'm new to all the technologies on this project, so likely doing something silly. Running
`ng serve`
I'm getting the error
`error TS2322: Type 'Observable<{}[]>' is not assignable to type 'Observable<Question[]>'`
I'm guessing I have a configuration wrong? Below are my versions and the error message.
`PS C:\files\projects\rwa-trivia-master-bitbucket\projects\trivia> ng v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / | | | | |/ _
| '__| | | | | | |
/ ___ | | | | (| | || | | (| | | | || | | |
// __| ||_, |_,||_,|| _|||
|___/
Angular CLI: 7.1.4
Node: 10.16.2
OS: win32 x64
Angular: 7.1.4
... cli, common, compiler, compiler-cli, core, forms, http
... platform-browser, platform-browser-dynamic, platform-server
... router, service-worker, upgrade
@angular-devkit/architect 0.11.4
@angular-devkit/build-angular 0.11.4
@angular-devkit/build-ng-packagr 0.11.4
@angular-devkit/build-optimizer 0.11.4
@angular-devkit/build-webpack 0.11.4
@angular-devkit/core 7.1.4
@angular-devkit/schematics 7.1.4
@angular/animations 7.2.15
@angular/cdk 7.2.2
@angular/fire 5.2.1
@angular/flex-layout 7.0.0-beta.24
@angular/material 7.2.2
@angular/pwa 0.11.4
@ngtools/json-schema 1.1.0
@ngtools/webpack 7.1.4
@schematics/angular 7.1.4
@schematics/update 0.11.4
ng-packagr 4.7.1
rxjs 6.5.2
typescript 3.1.6
webpack 4.23.1
PS C:\files\projects\rwa-trivia-master-bitbucket\projects\trivia> ng serve
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
11% building modules 15/20 modules 5 active ...jects\trivia\src\styles\dark.theme.scssBrowserslist: caniuse-lite is outdated. Please run next command npm update caniuse-lite browserslist
Date: 2019-08-12T16:57:30.779Z
Hash: 1b4220ca6a423442e401
Time: 11077ms
chunk {main} main.js, main.js.map (main) 1.91 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 104 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 706 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 324 kB [initial] [rendered]
ERROR in ../shared-library/src/lib/core/services/game.service.ts(247,5): error TS2322: Type 'Observable<{}[]>' is not assignable to type 'Observable<Question[]>'.
Type '{}[]' is not assignable to type 'Question[]'.
Type '{}' is not assignable to type 'Question'.
Property 'id' is missing in type '{}'.
i 「wdm」: Failed to compile.`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.