Skip to content

Instantly share code, notes, and snippets.

@Mcdavid95

Mcdavid95/index-1.js

Last active Mar 12, 2020
Embed
What would you like to do?
SES RabbitMQ Tutorial
//const express = require('express');
// import publicMessage from Email service
const { publishMessage } = require('./emailWorker')
// .........................
// ...app.get
/**
* @post sensend email
*/
app.post('/email', (req, res) => {
const { body: { email } } = req;
const emailOptions = {
mail: [email],
subject: 'Email confirmed',
template: `
<body>
<p>Hi,</p>
<p>Thanks for your submission, your email address has been recorder successfully</p>
</body>
`
}
// call rabbitmq service to app mail to queue
publishMessage(emailOptions);
return res.status(202).send({
message: 'Email sent successfully'
})
})
// app.listen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment