A Serverless AWS service for sending emails with a contact form. Used for the form on my website.
-
Clone this repo
git clone https://github.com/punit-shah/contact-form-api.git cd contact-form-api
-
Install dependencies
yarn
-
Provide AWS credentials to Serverless
yarn sls config credentials --provider aws --key YOUR_ACCESS_KEY_ID --secret YOUR_SECRET_ACCESS_KEY
-
Create a
secrets.json
filecp secrets.example.json secrets.json
Set the following values:
NODE_ENV
- the stage to deploy to ("dev"
or"prod"
)EMAIL
- the email address to send emails to (must be verified with AWS SES)DOMAIN
- the domain your form lives on
-
Deploy the service
yarn deploy
-
Run the function locally with the data in
data.json
yarn invoke-local
-
Invoke the deployed function with the data in
data.json
yarn invoke-remote