From c36e3627628fdb3297998b938ca5a876516ad82e Mon Sep 17 00:00:00 2001 From: Vladimir Sizov Date: Sun, 15 May 2016 00:19:03 +0100 Subject: [PATCH] fixing Heroku deployment --- README.md | 23 +++++++++++++++++++++++ server.js | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8a32b96..77cb042 100644 --- a/README.md +++ b/README.md @@ -105,4 +105,27 @@ $ npm run clean Removes the compiled app file from build. +## Deploying to Heroku + +Build/deploy pipeline of this project relies on two environment variables: +``` +NPM_CONFIG_PRODUCTION=false +PRODUCTION=true +``` +When it comes to deploying to Heroku you have two options for deployment: + +### With "Deploy to Heroku" button +If you deploy on Heroku with the button on top of this page, you don't need to change anything as environment varialbes are read from `app.json` + +### With console +If you deploy to Heroku via command line (like in [this](https://devcenter.heroku.com/articles/getting-started-with-nodejs#deploy-the-app) tutorial), you will need to setup these 2 env variables. +In order to do this, execute next lines from console once you setup Heroku: + +``` +heroku config:set NPM_CONFIG_PRODUCTION=false +heroku config:set PRODUCTION=true +``` + +If you don't do this, Heroku will fail to build your app (during `git push heroku master`) as environment variables will not be set. + ## [Changelog](CHANGELOG.md) diff --git a/server.js b/server.js index 9627925..60ab2d0 100644 --- a/server.js +++ b/server.js @@ -1,4 +1,4 @@ -import express from 'express'; +var express = require('express'); const app = express();