Google App Engine is a part of the Google Cloud Suite which provides a cloud platform for developers where they can develop and host their apps. It provides easily configurable, fast and secure programming environments/tools with the help of which developers can setup a development environment in just a few minutes. Therefore developers don’t need to worry about configuring the environment, they can just focus on writing code. It supports all the popular programming languages Java, PHP, Node.js, Python, C#, .Net, Ruby and Go.
Till now there was no support for Node.js, but Google has just announced that developers will now be able to deploy their Node.js apps to the App Engine.
You must have a project on the Google Cloud Platform. If you don’t, create one using the GCP Console.
The development environment should be configured. You have 2 options here.
Only Node.js version 8 or greater is supported on App Engine.
Google Cloud SDK also installs gcloud command line tool.
There’s a sample Node.js repository on GitHub. Either clone it using git or download the zip.
git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples
Navigate to the below directory
cd nodejs-docs-samples/appengine/hello-world/standard
Install the required dependencies using npm utility
npm install
Start the web server
npm start
Check output
Since we have verified that our Hello World program is working fine, it’s time to deploy it.
If you had installed Google Cloud SDK properly (as mentioned in Prerequisites), you’ll have access to the gcloud command. Run it as below
gcloud app deploy
Your app should now be live at https://<PROJECT_ID>.appspot.com/
gcloud app browse
That’s it. You have successfully deployed your sample Node.js app on the Google App Engine.
Refer Google’s official guide on Building a Node.js App on App Engine
You can try out Google App Engine’s free tier to deploy your Node.js app and see if you like it.
Help us improve this content by editing this page on GitHub