-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
31 lines (24 loc) · 680 Bytes
/
server.js
File metadata and controls
31 lines (24 loc) · 680 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
const app = require('express')();
const cors = require('cors');
const bodyParser = require('body-parser');
const client = require('./src/client');
const config = require('./config/secrets.js');
const SwitchRouter = require('./routes/switch');
const logger = require('./logger');
const { token } = config.discord;
const PORT = process.env.PORT || 3000;
app.use(cors());
app.use(bodyParser.json());
app.use('/switch', SwitchRouter);
client.login(token);
app.listen(PORT, () => {
logger.info(`Listening on ${PORT}`);
});
process.on('unhandledRejection', function(reason, p) {
logger.error(
'Possibly Unhandled Rejection at: Promise ',
p,
' reason: ',
reason
);
});