-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
31 lines (24 loc) · 929 Bytes
/
server.js
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
28
29
30
31
require("dotenv").config();
const express = require("express");
const bodyParser = require("body-parser");
const { Email } = require("./notifications");
const { token } = require("./notifications/config");
const { setWebHook } = require("./controllers");
const email = require("./notifications/email");
port = process.env.PORT || 8081;
const contenttest = {
html: "<b>Hey there! </b><br> This is our first message sent with Nodemailer",
};
const app = express();
app.use(bodyParser.json());
app.get("/", (req, res) => {
res.send({ message: "welcome to prdocution test" });
});
app.get("/send", async (req, res) => {
const info = await Email.send("tayuhermon@gmail.com", contenttest, "test");
console.log(info);
res.send({ message: "message sent successfully" });
});
app.post("/telegram-webhook/" + token, setWebHook);
app.listen(port, () => console.log(`server running on port ${port}`));
module.exports = app;