Open morenoh149 opened 5 years ago
I updated this pr to have the server restart via nodemon when the source changes. And the start script builds the server before serving.
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
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 👍
@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]: > fullstack-apollo-express-postgresql-boilerplate@1.0.0 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]: > fullstack-apollo-express-postgresql-boilerplate@1.0.0 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
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 - I only did git clone and npm install.
@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.
fixes #37