Skip to content

Commit

Permalink
add support for pushing and running on heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
Deityhub committed Feb 6, 2019
1 parent f42a475 commit b9e333d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
"webpack-dev-server": "3.1.14"
},
"scripts": {
"start": "webpack --mode development",
"dev": "webpack-dev-server --mode development --open",
"build": "webpack --mode production"
"start": "node server.js",
"dev": "webpack-dev-server --mode development",
"build": "webpack --mode production",
"heroku-postbuild": "yarn run build"
},
"dependencies": {
"@babel/runtime": "7.2.0",
Expand Down
13 changes: 13 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const express = require("express");
const path = require("path");

const app = express();

app.use(express.static(path.join(__dirname, "build")));

app.get("*", (req, res) => {
res.sendFile(path.join(__dirname, "build", "index.html"));
});

const port = process.env.PORT || 4444;
app.listen(port, () => console.log(`server running on port ${port}`));

0 comments on commit b9e333d

Please sign in to comment.