-
Notifications
You must be signed in to change notification settings - Fork 11
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
Move gemini rating logic to server #14
base: main
Are you sure you want to change the base?
Conversation
devnook
commented
Jul 8, 2024
- Adds a Cloud function in /functions dir that serves Gemini powered ratings.
- Removes gemini logic from the frontend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, modulo one console.log()
leftover.
functions.http('product-reviews-gemini-get-rating', async (req, res) => { | ||
res.set('Access-Control-Allow-Origin', '*'); | ||
if (req.method === 'OPTIONS') { | ||
console.log('is OPTIONS') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log('is OPTIONS') |
return res.status(204).send(''); | ||
} | ||
|
||
if (!req.body.review) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive by comment: would it make sense to implement a few best practices here around making sure that calls only come from your own website? (e.g. checking referrer...). I know that this can easily be spoofed, but might be a good indicator for people looking at this that they should think about how to secure their API endpoints.
This might also be complete overkill here...
@devnook this PR has conflicts and can't be merge. Is it still going to be updated or should it be closed? |