-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.js
More file actions
38 lines (30 loc) · 994 Bytes
/
index.js
File metadata and controls
38 lines (30 loc) · 994 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
30
31
32
33
34
35
36
37
38
const express = require('express');
const app = express();
__path = process.cwd();
const bodyParser = require("body-parser");
const PORT = process.env.PORT || 8000;
let code = require('./pair');
let qrCode = require('./qr');
require('events').EventEmitter.defaultMaxListeners = 500;
app.use('/code', code);
// مسیر برای فایل pair.html
app.use('/pair', async (req, res, next) => {
res.sendFile(__path + '/checker.html');
});
app.use('/qr', async (req, res, next) => {
res.sendFile(__path + '/checker2.html');
});
app.use('/pair420', async (req, res, next) => {
res.sendFile(__path + '/pair.html');
});
app.use('/qr420', qrCode);
// مسیر برای فایل اصلی index.html
app.use('/', async (req, res, next) => {
res.sendFile(__path + '/index.html');
});
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.listen(PORT, () => {
console.log(`⏩ Server running on http://localhost:` + PORT);
});
module.exports = app;