API: subscribe endpoint
garyhtou opened this issue · comments
Gary Tou commented
Accepts a POST with the following in the body:
email
location
Upon a successful subscription, return with a 200 status code. The body of the response is not important, although the current implementation returns the full object.
Upon a failed request:
- Return a non-2XX (e.g. 400) status code
- Short human-readable message in
error
key of the response body (will be display in UI)- The current usage depends on this, but we can change how errors are returned to the front end!
Existing implementation: https://github.com/hackclub/hackathons/blob/main/pages/api/subscribers/create.js
Usage: https://github.com/hackclub/hackathons/blob/main/components/signup.js#L31