Our users will probably want to always be paired to meet new people, so we have to avoid repetitive meetings. How should we handle this?
First, we need to allow for a method to set up new meetings. Think of it as a button in an app that would trigger a request to the route POST/meeting/new
.
This endpoint will reply with the status 200
when the request is allowed and a pair is found, or if there is no pair but they are now attached to a meeting
object and can now be matched with another user; 412
if the user is already scheduled in another meeting and 400
in case the expected e-mail of the user isn't sent; in this case, it can't be fulfilled because the user wasn't specified.
Note
The usage of status codes is somewhat subjective, (see a more comprehensive list on Wikipedia at http://en.wikipedia.org/wiki/List_of_HTTP_status_codes). However, having distinct responses is important so that the client can display meaningful messages to the user.
Let's implement an Express...