Last active
December 10, 2017 12:31
-
-
Save guilatrova/68c0836e6f59c069dced32bef8ab4a5f to your computer and use it in GitHub Desktop.
Latrova Commits Deploy /dist to Heroku with Express
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
... | |
"engines": { | |
"node": "6.11.1", | |
"npm": ">=3" | |
}, | |
"scripts": { | |
... | |
"build": "babel-node tools/build.js && npm run open:dist", | |
"heroku-prebuild": "", | |
"heroku-postbuild": "babel-node tools/build.js", | |
... | |
}, | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: node server.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable */ | |
var express = require('express'); | |
var path = require('path'); | |
var port = process.env.PORT || 3000; | |
var app = express(); | |
app.use(express.static(path.join(__dirname, 'dist'))); | |
app.get('*', (_req, res) => { | |
res.sendFile(path.join(__dirname, 'dist/index.html')); | |
}); | |
app.listen(port, (err) => { | |
if (err) { | |
console.log(err); | |
} else { | |
console.log(`server started port: ${port}`); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment