diff --git a/server.js b/server.js index 0ea947c..e0707f1 100644 --- a/server.js +++ b/server.js @@ -1,16 +1,34 @@ //Install express server +// const express = require('express'); +// const path = require('path'); + +// const app = express(); + +// // Serve only the static files form the dist directory +// app.use(express.static(__dirname + '/dist/ZID')); + +// app.get('/*', function (req, res) { + +// res.sendFile(path.join(__dirname + '/dist/ZID/index.html')); +// }); + +// // Start the app by listening on the default Heroku port +// app.listen(process.env.PORT || 8080); + const express = require('express'); +const http = require('http'); const path = require('path'); const app = express(); -// Serve only the static files form the dist directory -app.use(express.static(__dirname + '/dist/ZID')); +app.use(express.static(path.join(__dirname, 'dist'))); -app.get('/*', function (req, res) { - - res.sendFile(path.join(__dirname + '/dist/ZID/index.html')); +app.get('/*', (req, res) => { + res.sendFile(path.join(__dirname, 'dist/ZID/index.html')); }); -// Start the app by listening on the default Heroku port -app.listen(process.env.PORT || 8080); \ No newline at end of file +const port = process.env.PORT || '6797'; +app.set('port', port); + +const server = http.createServer(app); +server.listen(port, () => console.log('Running')); \ No newline at end of file