Skip to content

Commit

Permalink
Fix server?
Browse files Browse the repository at this point in the history
  • Loading branch information
cuzi committed Jun 2, 2018
1 parent 9f6c71d commit 75aaa9e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const express = require('express');
const path = require('path');
const port = 8080;
const port = process.env.PORT || 8080;
const app = express();

// the __dirname is the current directory from where the script is running
app.use(express.static(__dirname));
app.use(express.static(__dirname + '/public'));

// send the user to index html page inspite of the url
app.get('*', (req, res) => {
res.sendFile(path.resolve(__dirname, 'public/index.html'));
res.sendFile(path.resolve(__dirname, 'index.html'));
});

app.listen(port);

0 comments on commit 75aaa9e

Please sign in to comment.