-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathindex.js
More file actions
54 lines (42 loc) · 1.19 KB
/
index.js
File metadata and controls
54 lines (42 loc) · 1.19 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const express = require('express');
const path = require('path');
const app = express();
__path = process.cwd()
const bodyParser = require("body-parser");
const PORT = process.env.PORT || 5000;
const {
qrRoute,
pairRoute
} = require('./routes');
require('events').EventEmitter.defaultMaxListeners = 2000;
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.static(path.join(__dirname, 'public')));
app.use('/qr', qrRoute);
app.use('/code', pairRoute);
app.get('/pair', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'pair.html'));
});
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
app.get('/pairing', (req, res) => {
res.redirect('https://github.com/Casper-Tech-ke/pairing');
});
app.get('/projects', (req, res) => {
res.redirect('https://xcasper.space');
});
app.get('/health', (req, res) => {
res.json({
status: 200,
success: true,
service: 'Pairing',
timestamp: new Date().toISOString()
});
});
app.listen(PORT, '0.0.0.0', () => {
console.log(`
Deployment Successful!
Pairing Server Running on http://localhost:` + PORT)
})
module.exports = app