An example of how to set your Node.js application up to enable deployment on Kinsta App Hosting services.
Kinsta is a developer-centric cloud host / PaaS. We’re striving to make it easier for you to share your web projects with your users. Focus on coding and building, and we’ll take care of deployment and provide fast, scalable hosting. + 24/7 expert-only support.
During the deployment process Kinsta will automatically install dependencies defined in your package.json
file.
Kinsta automatically sets the PORT
environment variable. You should not define it yourself and you should not hard-code it into the application. Use process.env.PORT
in your code when referring to the server port.
app.listen(process.env.PORT, () => {
console.log(`Hello World Application is running on port ${process.env.PORT}`)
})
When deploying an application Kinsta will automatically create a web process with npm start
as the entry point. Make sure to use this command to run your server. If you would like to use another command you will need modify the runtime process in MyKinsta.
"scripts": {
"start": "node server.js"
},
Whenever a deployment is initiated (through creating an application or re-deploying due to an incoming commit) the npm build
command is run, followed by the npm start
command.