Conversation
|
|
||
| const translation = await retrieveData(language, 'translations', { signed: signedProcessedText.hash }) | ||
|
|
||
| if (!translation) throw new NotFoundError() |
There was a problem hiding this comment.
It's important to keep this validation error.
There was a problem hiding this comment.
In this case, shouldn't we just return no translation and let the backend handle this and show an alert to the user that no translation was found?
As our database is still small, most phrases will return no translation.
There was a problem hiding this comment.
This is the backend repo and NotFoundError is equal to no translation was found.
src/routes/translate/get.js
Outdated
| translations.retrieve(value.params.language, sanitize(value.query.text)) | ||
| .then(response => { | ||
| res.locals = response | ||
| res.set('Access-Control-Allow-Origin', '*') |
There was a problem hiding this comment.
Have you tried using localhost instead of *?
filipecorrea
left a comment
There was a problem hiding this comment.
We should revert the changes on src/controllers/translations/retrieve.js, there's no need for those changes in this pull request.
| ALLOWED_ORIGINS=http://localhost:3001 | ||
| ``` | ||
|
|
||
|
|
There was a problem hiding this comment.
Instead of setting ALLOWED_ORIGINS as mandatory, can we set it to http://localhost:3001 by default and move the update instruction to the Customize section bellow?
Fixes #36
Overview
Changes for running the backend outside the cloud.