Skip to content

Event driven example of sending an email with a mustache template in Nitric

Notifications You must be signed in to change notification settings

raksiv/nitric-aws-ses-mustache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

Event driven example of sending an email with a mustache template in Nitric

Usage

Step 1: Install Nitric

Prerequisites
MacOs

Install with homebrew

brew install nitrictech/tap/nitric
Windows

Install with scoop

scoop bucket add nitric https://github.com/nitrictech/scoop-bucket.git
scoop install nitric
Linux

Download as a scripted install via curl.

curl https://nitric.io/install | bash

Note: Complete installation guide can be found here


Step 2: AWS Configuration

mv env-template .env
AWS_SES_REGION="us-east-1"
AWS_SES_ACCESS_KEY_ID="..."
AWS_SES_SECRET_ACCESS_KEY="..."

SENDER_EMAIL="..."
SYS_ADMIN_EMAIL="..."

Note: You'll need to whitelist these emails with amazon to send emails

Step 3: Run the API locally with Nitric

yarn install
nitric run

Step 4: Consume the API

curl --location --request GET 'http://127.0.0.1:9001/apis/main/welcome/user'
{ "message": "Glad you're here developing with us - user." }
curl --location --request GET 'http://127.0.0.1:9001/apis/main/events'
{
    "output": {
        "documents": [
            {
                "ref": {
                    "documentClient": {},
                    "parent": {
                        "documentClient": {},
                        "name": "msg"
                    },
                    "id": "e9e18a55-6ed3-4781-b3f7-820ce221eb93"
                },
                "content": {
                    "id": "e9e18a55-6ed3-4781-b3f7-820ce221eb93",
                    "message": "Glad you're here developing with us - user.",
                    "timestamp": "1646942233037"
                }
            }
        ],
        "pagingToken": null
    }
}

What's next?

Explore the Nitric framework to learn how to deploy to the cloud and much more.

About

Event driven example of sending an email with a mustache template in Nitric

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published