-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (20 loc) · 675 Bytes
/
index.js
File metadata and controls
29 lines (20 loc) · 675 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var express = require('express');
const sendEmail = require('./api/sendEmail');
const app = express();
const port = process.env.PORT || 4000;
app.get('/', (req, res) => {
res.send('Use /sendemail api to send email');
});
app.get('/sendemail', (req, res) => {
if(req.path === '/sendemail'){
const args = {
from: 'renjithmails@gmail.com',
to: req.query.to,
subject: req.query.subject,
body: req.query.body,
html: req.query.html
};
sendEmail.send(res, args, 0);
}
});
app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`));