forked from containersworkshop/notificationservice2222
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
21 lines (16 loc) · 819 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const email = require('./email');
const express = require('express');
const app = express();
const port = 3005;
app.use(express.urlencoded());
app.use(express.json());
app.get('/api/notification/healthcheck', (req, res) => res.send('Notification Service is up and running!'));
app.post('/api/notification/sendEmail', (req, res) => {
console.log("Request Body " + req.body);
email.sendEmail(req.body.BidUser, "Payment Succeeded - OAS", "Thank you for making a payment for your Auction: " + req.body.IdAuction, function (err, result) {
if (err) return res.status(500).send('Error occurred while sending email');
console.log("Result is " + result);
return res.status(201).json(result);
});
});
app.listen(port, () => console.log(`Notification Service listening on port ${port}!`));