Deploying voting app

I just finished the voting app, the first of the full stack projects. I’m having trouble deploying it, whether it be on heroku or glitch. I’ve googled around and the solutions haven’t worked. I’m trying to figure out a way to deploy my app.

Here is my code.

I have a server at index.js, and then I have within the client folder code that was built off of create react app.

In my express router, I serve the client’s index.html.

In my primary package.json I concurrently run both the nodemon server and the create react app client.

I have the jwt secret and mlab url in my config.js.

The app works just fine on my local machine. I just can’t seem to figure out how to deploy it.

-Thanks.

I’m not sure exactly how to deploy on Glitch, but Heroku will require you to specify how you run your app under the ‘Resources’ tab. Your app shouldn’t be using the client dev server and you want to make sure your Express server isn’t running in dev mode. It looks like the NPM task client will build your front end and (I assume) place the output in the correct directory. You’ll want to run this task first, then start your server normally. So, your web command should look something like this:

npm run client && npm run prod

where prod is a new task that runs Node without Nodemon. Here’s what one of my apps looks like on Heroku

03%20PM

populate_movies is a separate script that I have setup outside of the Node server I’m running, but when it’s complete, the npm task start kicks in. This happens every time the server is restarted because it’s specified as the web command.

If you have more questions, we’d need to know more about what you’ve tried to get your apps deployed.