Google App Engine supports NodeJS platform. Just follow below steps to deploy your NodeJS application.

Step 1 : Setup Node

Download and install NodeJS
Install ExpressJS
npm install express

Step 2 : Setup Google Cloud SDK

If you are using Linux or Mac, use below commands 
$ curl https://sdk.cloud.google.com | bash
$ exec -l $SHELL
If you are using windows, download google-cloud-sdk from here, you need to install python 2.7 to run this google cloud sdk

Step 3 : Create app in google cloud plateform

  1. Open the Cloud Platform Console.
  2. In the drop-down menu at the top, select Create Project.
  3. Click Show advanced options. Under App Engine location, select a United States location.
  4. Give your project a name.
  5. Note the Project ID because it will be used for commands and in configurations.

Step 4 : Initiate Google Cloud SDK

Execute below command to initiate Google cloud sdk
gcloud init
Now it will ask for authentication, ( it will show you web browser, there you need to enter your google account credentials). Once after successful authentication, it will ask you for app id. Enter app id that you have created in above step

Step 5 : Create Hello World NodeJS app

Lets create NodeJS hello world app. Here you need these below files to create first hello world app. You can download hello world app from here
  1. app.js - Main code to run app
  2. app.yaml - important for google app engine, Which specifies runtime as NodeJS
  3. package.json - this file contains different types of data like version, name of the app. Minimum nodejs version required to run app..etc

Step 6 : Deploy App

Run below command on above hello world app directory. 
gcloud preview app deploy app.yaml --promote
Wait for some time. Once after you app deployed, you can check your app at https://<your-app-id>.appspot.com

Note

If you want change your app id or current google account, then you should execute step 4 again

0 comments:

Blogroll

Follow this blog by Email

Popular Posts