-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
26 lines (20 loc) · 880 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
/* This code creates a special Node JS server that can serve minified/uglified JS. */
const express = require('express'),
favicon = require('express-favicon'),
path = require('path'),
port = process.env.PORT || 8000,
app = express();
app.use(favicon(__dirname + '/build/favicon.ico'));
// the __dirname is the curent dir from where the script is running
app.use(express.static(__dirname));
app.use(express.static(path.join(__dirname, 'build')));
/*app.get('/ping', function(req, res) {
// '/ping' is a meaningless path you can use to test that the server is working.
return res.send('This is a repsonse...');
});*/
app.get('/*', function (req, res) {
// res.sendFile(path.join(__dirname, 'build', 'index.html'));
res.sendFile('index.html', { root: path.join(__dirname, '../../../dist') });
});
app.listen(port);
console.log('Server is running app on port ' + port);