This Firebase Function is responsible for the CruzHacks mailing list. This service uses the MailChimp REST API.
- Can be found inside
package.json
file. Installed using the following command:yarn
oryarn -i
oryarn install
within the/functions
directory
yarn serve
- Begin an emulator suite at
localhost:4000
with your function being served atlocalhost:5000
. You can navigate the UI of the Emulator Suite to find the actual endpoint. - Note: Cors must properly be configured on the client side
This project uses Jest. Run all tests via yarn test
.
Can be obtained by running firebase functions:config:get > .runtimeconfig.json
within your /functions
directory
Can be set by running firebase functions:config:set example.key="val"
curl --request GET \
--url http://localhost:5001/cruzhacks-4a899/us-central1/subscribe \
--header 'authentication: API_KEY' \
--header 'content-type: application/json' \
--data '{
"email": "[email protected]"
}'
{
"error": false,
"status": 201,
"message": "[email protected] added to the mailing list"
}
{
"error": false,
"status": 200,
"message": "[email protected] is already subscribed"
}
{
"error": true,
"status": 401,
"message": "Unable to authenticate request"
}
{
"error": true,
"status": 400,
"message": "Invalid or missing email in request body"
}
{
"error": true,
"status": 500,
"message": "Mailchimp Error: ERROR MESSGE HERE."
}
- Firebase Functions
- NodeJS
- Jest
- Github Actions
- Prettier
- Eslint