CodeDoesGood / org-website

CodeDoesGood Organization website source code
http://codedoesgood.org
1 stars 0 forks source link

Website API / Backend #20

Open renatomcamilio opened 7 years ago

renatomcamilio commented 7 years ago

This task will be updated with more details as we figure out what might be needed; So far, work to be done on the backend:

stephen-slm commented 7 years ago

Estimate: Unavailable

I cannot really set a estimate due a core part is based on when the volunteer software database is accessible to pull the data from.

renatomcamilio commented 7 years ago

Thanks for the update, this one (regarding the volunteer software integration) is definitely on hold. We can even break into its own task.

stephen-slm commented 7 years ago
if (_.isNil(sender.name) || _.isNil(sender.email) || _.isNil(sender.text)) {
  // TODO: Find out what our frontend is expecting in formatted response
  return res.status(400).send('Invalid format')
}

When we reject or return the clients request what is the format that will be sent back? What do we feel should be the response format? (for replacing 'Invalid format')

for example:


{
  message: 'Response message'
  content: { /** A object containing any content requested? **/ }
}
renatomcamilio commented 7 years ago

So for error responses, we would set the status just like you've done, 400 for a client error, and send a payload like this:

{
  error: 'Invalid format',
  description: 'Please, make sure you\'ve filled all of the required fields'
}

The idea is to follow a convention that the frontend can handle smoothly -- giving enough context to our users without having to write specific logic around that.

For successful response, we can follow REST patterns. e.g. for the contact form submission (POST), you would return status 200 basically, no need to send nothing in the payload.

stephen-slm commented 7 years ago

Update:

Core base in ready for the start of UI works, test framework will begin tomorrow.

stephen-slm commented 7 years ago

Update: Will be away from the 23rd to the 11th of Aug as i'm out the country.