-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
25 lines (19 loc) · 659 Bytes
/
app.js
File metadata and controls
25 lines (19 loc) · 659 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
const express = require('express'),
bodyParser = require('body-parser'),
logger = require('morgan'),
emailSender = require('./utils/mailSender'),
config = require('config'),
app = express(),
port = config.PORT;
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended : false}));
app.use(logger('dev'));
app.post('/sendMail', (req,res) => {
emailSender(req.body.to,req.body.subject,req.body.body, (err,result) => {
if(err) return res.status(500).send(err);
return res.status(200).send(result);
});
});
app.listen(port, () => {
console.log('App listening on port: ' + port);
});