Open In App

Deploy & Run a Node.js Web Application on App Engine

Google Cloud Platform is one of the cloud service providers that provide various cloud services for a seamless experience. It provides various services like storage, networks, development tools, Analytics tools, infrastructure, and many more. To learn more about GCP you can follow this article

Terminologies

How to deploy a web application on GCP?




const express = require('express');
const app = express();
const port = 8000;
  
app.get('/',(req,res)=>{
    res.send("Hello World From GFG");
})
  
app.listen(port,()=>{
    console.log("Server Started On "+port);
})

npm install express

{
“dependencies”: {
“express”: “^4.18.2”
},
“scripts”: {
“start”: “node app.js”
}
}


npm start

runtime : nodejs18
gcloud init
gcloud app create
gcloud app deploy



gcloud app browse

Troubleshooting A Deployed Web Application On GCP

Conclusion

From this article we have learnt about deployment of NodeJS web applications on google cloud platform. We have also seen step by step process to deploy an web application.

Frequently Asked Questions (FAQs)

1. What are other options to deploy a NodeJS web application in GCP ?

There are options like Cloud Run , Cloud functions and Instances where you can deploy the NodeJS Application.

2. Why App Engine is better option over other services in GCP for deploying NodeJS web application ?

App engine is fully managed platform where you just have to provide your code . All other things will be taken care by GCP hence it is a better option over other services.

3. How to update NodeJs application and redeploy on app engine ?

Update your code of the application on your machine and simply run deploy command for app engine which will redeploy the running application and update it to the newest version.

4. What is difference in App Engine and Cloud Run ?

The main difference between them is that Cloud Run is designed for teams that include both software developers and ops experts, while App Engine is designed for developers1. Cloud Run is a newer service that only runs when it is serving requests, while App Engine has been around for longer and has automatic scaling


Article Tags :