[Vuejs]-Deploy an application that uses two ports

1👍

You’re using Vue, so in development, the frontend is being served locally by Webpack’s devServer on port 8080. You’re also running a node server in development which simulates the API portion of your production server.

In actual production, there is no need for 2 servers or 2 ports. In production, you don’t need a dedicated server for your frontend. That’s just for rapid and convenient development. Have the node production server serve the frontend as well. Something like this depending on your server structure:

// Static assets
app.use(express.static(path.join(__dirname, 'dist')));

Heroku doesn’t support multiple ports, and you don’t need them. It’s possible (and normal) to serve both backend and frontend from one domain.

👤Dan

Leave a comment