This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require ('aws-sdk'); | |
AWS.config.update({ | |
accessKeyId: 'ACCESS_KEY', | |
secretAccessKey: 'SECRET_KEY', | |
region: 'REGION' | |
}); | |
const sns = new AWS.SNS(); | |
sns.createPlatformEndpoint({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* without using async/await | |
*/ | |
exports.updateUserAndSendEmail = (req, res) => { | |
User.findOne({ email: req.body.email }, (error, retrievedUser) => { | |
if (error) { | |
console.log('error'); | |
} | |
if(retrievedUser) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk'); | |
AWS.config.update({ | |
region: 'region', //https://docs.aws.amazon.com/sns/latest/dg/sms_supported-countries.html follow this link for supported region | |
accessKeyId: 'access key', | |
secretAccessKey: 'secret key' | |
}); | |
const sns = new AWS.SNS(); | |
const params = { | |
Message: 'Your OTP is 123456', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
server { | |
listen 80; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const port = 3000; | |
app.get('/', (req, res) => { | |
res.send('Hello World'); | |
}); | |
app.listen(port, () => { | |
console.log(`Server started on port ${port}`); |