-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
44 lines (32 loc) · 1.07 KB
/
server.js
File metadata and controls
44 lines (32 loc) · 1.07 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
// const express = require('express');
// const http = require('http');
// const socketIO = require('socket.io');
// const port = 4001;
// const app = express();
// // our server instance
// const server = http.createServer(app);
// const io = socketIO(server);
// io.on('connection', socket => {
// console.log('User connected');
// socket.on('store change', (store) => {
// io.sockets.emit('change store', store);
// });
// socket.on('disconnect', () => {
// console.log('user disconnected');
// });
// });
// server.listen(port, () => console.log(`Listening on port ${port}`));
const path = require('path');
const express = require('express');
const app = express();
const PORT = process.env.PORT || 8080;
// app.use(express.static(path.join(__dirname, 'dist')));
app.use(express.static('vr/build'))
app.get('*', function(req, res) {
res.sendFile(path.resolve(__dirname, 'index.html'));
});
app.listen(PORT, error => (
error
? console.error(error)
: console.info(`Listening on port ${PORT}. Visit http://localhost:${PORT}/ in your browser.`)
));