Skip to content

Instantly share code, notes, and snippets.

@Mcdavid95
Last active March 12, 2020 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mcdavid95/6780e42c08e4b12ac055e5bedb2de24f to your computer and use it in GitHub Desktop.
Save Mcdavid95/6780e42c08e4b12ac055e5bedb2de24f to your computer and use it in GitHub Desktop.
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