OpsCaptain Node.js hosting platform allows you to run and scale Node.js apps in the cloud of your choice without the pain of managing deployments, builds, proxies and configuring databases. You can do all of this with a simple point and click interface and the CLI.
Install the opscaptain-cli on your local machine and also log in. If you haven't, run the below commands from your terminal to install it and login:
You must have already added the server that will be used to host your Node.js app. To add a server to your OpsCaptain account, follow this guide here.
From the dashboard: Log into the dashboard and create a new app using this link. Once the app is created, you can then proceed to deploy your code to it.
The runtime exports a variable with name PORT. You must listen for incomming connections using this variable instead of hardcoding any random port in your code which will only work in your local environment but not anywhere else.
Check out the below examples and how to properly configure the listen port for your Node.js app
Create a file in the folder that contains your project. Name this file ocmanifest.json. Enter any environment variables you may want to set and also the name of your app. In our case the name of our app is [helloworld]. We do not have any environment variables so we will not set any.
CD into the project directory. Once there, run the below command to deploy