Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding query,facts,video functions #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

adding query,facts,video functions #4

wants to merge 2 commits into from

Conversation

artiJangra
Copy link
Collaborator

No description provided.

//<--------Random Fact Generation---------->
//Generates random fact about techspardha.
exports.randomFact = functions.https.onRequest((request , response) => {
const numberOfLines = 8;
Copy link
Owner

@devgrpnitkkr devgrpnitkkr Sep 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to change it as per the number of facts.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay.

});
});
});
response.status(401).json(items);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think directly returning snapshot.val() should work. no need to iterate and make separate object

//only add newly asked query to the database.
exports.addQuery = functions.https.onRequest((request,response)=>{
const query = request.query.text;
var newPostKey = admin.database().ref().child('queries').push().key;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validate query if not null.
Need to add captcha validation.
Directly push into reference, why building a separate object?

Copy link
Owner

@devgrpnitkkr devgrpnitkkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add caching also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants