fullstack-apollo-express-postgresql-boilerplate icon indicating copy to clipboard operation
fullstack-apollo-express-postgresql-boilerplate copied to clipboard

Herokuize project

Open morenoh149 opened this issue 6 years ago • 7 comments

  • add build step to project
  • add dev script
  • instruct to use DATABASE_URL
  • the flow is inspired by https://stackoverflow.com/a/34484065/630752

fixes #37

morenoh149 avatar Feb 21 '19 03:02 morenoh149

I updated this pr to have the server restart via nodemon when the source changes. And the start script builds the server before serving.

morenoh149 avatar Mar 08 '19 04:03 morenoh149

Why? The changes required to make the api run without issues in heroku do not prevent you from running it locally. These changes are just following best practices imo

morenoh149 avatar May 14 '19 04:05 morenoh149

Thanks for your changes @morenoh149 I will take this change into account once I rewrite the tutorial for this application. Thanks for your help here 👍

rwieruch avatar May 14 '19 09:05 rwieruch

@morenoh149 I get the following error for this PR when I try to deploy it to Heroku:

2019-07-08T15:57:30.637694+00:00 heroku[web.1]: Starting process with command npm start 2019-07-08T15:57:33.209737+00:00 app[web.1]: 2019-07-08T15:57:33.209759+00:00 app[web.1]: > [email protected] start /app 2019-07-08T15:57:33.209762+00:00 app[web.1]: > npm run build && node src/index.js 2019-07-08T15:57:33.209763+00:00 app[web.1]: 2019-07-08T15:57:33.683559+00:00 app[web.1]: 2019-07-08T15:57:33.683596+00:00 app[web.1]: > [email protected] build /app 2019-07-08T15:57:33.683598+00:00 app[web.1]: > babel src --out-dir dist 2019-07-08T15:57:33.683600+00:00 app[web.1]: 2019-07-08T15:57:36.905982+00:00 app[web.1]: Successfully compiled 24 files with Babel. 2019-07-08T15:57:37.073024+00:00 app[web.1]: /app/src/index.js:3 2019-07-08T15:57:37.073028+00:00 app[web.1]: import 'dotenv/config'; 2019-07-08T15:57:37.073030+00:00 app[web.1]: ^^^^^^^^^^^^^^^ 2019-07-08T15:57:37.073031+00:00 app[web.1]: 2019-07-08T15:57:37.073037+00:00 app[web.1]: SyntaxError: Unexpected string

ACPK avatar Jul 08 '19 15:07 ACPK

that's javascript complaining that import is not valid js. You can fix this by fixing the babel config or writing your code with syntax that is supported by nodejs without transpilation. I can't advise as I'm not working on a node/graphql api atm. Shouldn't be too hard to figure out imo.

morenoh149 avatar Jul 09 '19 06:07 morenoh149

@morenoh149 - I only did git clone and npm install.

ACPK avatar Jul 09 '19 14:07 ACPK

@ACPK this repo was not developed to work on heroku, that is why I opened this issue because I thought running on heroku would be useful.

morenoh149 avatar Jul 09 '19 19:07 morenoh149