Send emails to users who sign up to be notified about Permit Applications or other events.
Each application, (noteapi, messages, and ses-bounce-processing) needs a new file .env (based on .env.example) NOTE: This is actually a Terraform formatted variable file, which requires strings to be in double quotes.
All Lambdas are deployed like this, (After getting proper permissions to AWS and changing to dir)
First run npm install
package.json has these scripts:
- Test Locally:
npm start
- Deploy:
npm run deploy
- Destroy: (removes all objects from AWS)
npm run destroy
- Clean:
npm run clean(removes local temp files)
The Deploy/Destroy commands use the name of the active GitHub branch when creating AWS resources. For example, if the active GitHub branch is "feature" and the name of the resource is "template", the resource is named "template_feature". For API gateway domains, it's "feature-template.ashevillenc.gov". Production (or main) branches do not get a prefix/suffix.
Make sure the variable unsub_url is set correctly for dev or prod.
- noteapi/ This is the backend of the City of Asheville Notifications App. It provides a GraphQL API for the Notifications frontend
CORS configuration for the API is done in the file noteapi/src/util/cors.js
For local API testing, set these variables in noteapi/.env :
send_email=false # Set to true to test sending emails locally; you can use an AWS_PROFILE in the .env.
debug=true # allows introspection and playground options for Apollo Graphql server, and bypasses log-in requirement.Then run:
cd noteapi
npm install
npm start
npm start runs in-memory SQLite so it does not require an external database.
You can also run npm run startpg for a local test with a Postgres DB.
- messages/ Script to run nightly to send emails. The table notifications_permits is filled first. This is compared to notifications_permits_history. If there are new ones, the emails are sent and the new permits are copied to history.
There is no local DB option for local testing of messages, a Postgres DB connection is required.
cd messages
npm install
npm start
- ses-bounce-processing/ TODO: rewrite as Lambda.