This repository serves like an example of usage Cloudflare worker to sending different requests to Sendgrid API
- Send email - by pure sendgrid API (Docs link)
- Subscribe to newsletter - add contact to sendgrid marketing contact list (Docs link)
-
npm start
- start wrangler development server -
npm test
- test wrangler project
Add .dev.vars
file to have an access in code, example below:
SENDGRID_API_KEY="YOUR_SENDGRID_API_KEY"
SITE_HOST="http://localhost:3000"
Add environment variables by cloudflare worker settings panel