-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
28 lines (21 loc) · 973 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
require('dotenv').config({ path: '.env' });
const express = require('express');
const bodyparser = require('body-parser'); //read the code input
const cors = require('cors'); //for data-transfer b/w different browsers/servers - I assume for communicating between code and then live feed?
const pusher = require('pusher'); //refers to Pusher Channels - for literally updating the live feed?
const app = express();
const pusher = new pusher({
appId: process.env.PUSHER_APP_ID,
key: process.env.PUSHER_APP_KEY,
secret: process.env.PUSHER_APP_SECRET,
cluster: process.env.PUSHER_APP_CLUSTER,
useTLS: true,
});
app.use(cors());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(express.static(path.join(__dirname)));
app.set('port', process.env.PORT || 5000);
const server = app.listen(app.get('port'), () => {
console.log('Express running -> PORT ${server.address().port}');
});