jm-shi / MERN-Social-Network

Building a social network with MERN stack
MIT License
264 stars 79 forks source link

unable to deploy on heroku #5

Closed zeeshanweb-official closed 4 years ago

zeeshanweb-official commented 4 years ago

hi sir.. i used this boilerplate and changed the client app and also the things in express server... i deployed it on heroku but its not working fine... its just serving the static files no get or post api is working... kindly help me.

jm-shi commented 4 years ago

Hey, if the API calls aren't working then the database credentials might be invalid. Did you add REACT_APP_DB_URI and REACT_APP_JWT_KEY as config variables on Heroku? I used mLab to set up the database a while back, but it looks like they closed new account creation a year ago. Alternatively you can now create a cluster on MongoDB Atlas and paste its connection string as the value for REACT_APP_DB_URI. REACT_APP_JWT_KEY could be set to any string.

zeeshanweb-official commented 4 years ago

sir i found the solution... the folder structure you made is not good... and the main issue was in the package.json file... there is a script heroku postbuild or something like that... it runs and made a build of client project... heroku doesnt care about it and deployed the client build as the main project... i deleted that script and it is now working fine

Muhammad Awais Zeeshan

+92307-4018-289

On Fri, Feb 21, 2020 at 12:31 PM Jamie Shi notifications@github.com wrote:

Hey, if the API calls aren't working then the database credentials might be invalid. Did you add REACT_APP_DB_URI and REACT_APP_JWT_KEY as config variables on Heroku? I used mLab to set up the database a while back, but it looks like they closed new account creation a year ago. Alternatively you can now create a cluster on MongoDB Atlas and paste its connection string as the value for REACT_APP_DB_URI. REACT_APP_JWT_KEY could be set to any string.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jm-shi/MERN-Social-Network/issues/5?email_source=notifications&email_token=AJ7PNOOZRBPIHHUMNHX6SULRD57L5A5CNFSM4KYMOHRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMRZEBY#issuecomment-589533703, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ7PNOLNN2SS2ZKLCZMDSRLRD57L5ANCNFSM4KYMOHRA .