Mailer Madness, (React frontend + AWS lambda/SendGrid)

const express = require('express');
const app = express();
require('dotenv').config()
const sgMail = require("@sendgrid/mail");
sgMail.setApiKey(process.env.SECRET_KEY);
const msg = {
to: "jack.sanders.xyz@gmail.com",
from: "jack.sanders.xyz@gmail.com",
subject: "heyy, I hope this works dude",
text: "whats up with this guy lolololol",
html: "<strong>the node email works okay hahaha please bro</strong>"
}
app.get('/', (request, response) => {
sgMail.send(msg)
response.json({ returnMessage: "check your email!!!" })
})
app.listen(4000)
$ npm init --y
$ npm i @sendgrid/mail
$ zip -r <nameOfYourZipFile>.zip ./
return {    
statusCode,
headers: {
"Access-Control-Allow-Origin": "http://localhost:3000",
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Methods": "OPTIONS,POST"
},

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store