-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (22 loc) · 704 Bytes
/
index.js
File metadata and controls
29 lines (22 loc) · 704 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
28
29
require('dotenv').config();
const express = require('express');
const cors = require('cors');
const port = process.env.PORT
const WhatsAppAPI = require('./modules/Whatsapp');
const router = require('./routes/send');
const { getQrFilePath } = require('./controllers/QrCode');
WhatsAppAPI();
const app = express();
app.use(cors({ origin: '*' }));
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use("/send", router);
app.get('/view-session-qrcode', async (req, res) => {
res.sendFile(await getQrFilePath());
});
app.all("/*", (req, res) => {
res.redirect('https://cttricks.com');
});
app.listen(port, () => {
console.log(`Goto http://localhost:${port}`);
})