sairaj
sairaj

Reputation: 413

how to deploy node app to Heroku if the code is in a subfolder?

I have a nextjs and nodejs app in client and server directories respectively, and I know that heroku needs package.json in the root folder to deploy the node app but, it is in the server directory, how can I deploy this, I tried everything I found in other StackOverflow questions but they have ancient solutions, that doesn't seem to work now, is there any workaround?

/myProject
 -- client
 -- server

Upvotes: 0

Views: 852

Answers (1)

JN Yiunn
JN Yiunn

Reputation: 21

It's possible to specify your start script by adding a file Procfile in the root directory.

You may need a Procfile like this:

web: cd client && npm start
worker: cd server && npm start

Next, Enable both web and worker in Heroku App > Resources Tab.


See the official doc also: https://devcenter.heroku.com/articles/deploying-nodejs#specifying-a-start-script

Upvotes: 1

Related Questions